Immunity is a central component of fitness in wild animals, but its determinants are poorly understood. In particular, the importance of locomotory activity as a constraint on immunity is unresolved. Using a piscine model (Gasterosteus aculeatus), we combined a 25‐month observational time series for a wild lotic habitat with an open flume experiment to determine the influence of locomotor activity (countercurrent swimming) on natural variation in immune function. To maximize the detectability of effects in our flume experiment, we set flow velocity and duration (10 cm/s for 48 hr) just below the point at which exhaustion would ensue. Following this treatment, we measured expression in a set of immune‐associated genes and infectious disease resistance through a standard challenge with an ecologically relevant monogenean infection (Gyrodactylus gasterostei). In the wild, there was a strong association of water flow with the expression of immune‐associated genes, but this association became modest and more complex when adjusted for thermal effects. Our flume experiment, although statistically well‐powered and based on a scenario near the limits of swimming performance in stickleback, detected no countercurrent swimming effect on immune‐associated gene expression or infection resistance. The field association between flow rate and immune expression could thus be due to an indirect effect, and we tentatively advance hypotheses to explain this. This study clarifies the drivers of immune investment in wild vertebrates; although locomotor activity, within the normal natural range, may not directly influence immunocompetence, it may still correlate with other variables that do.