BackgroundWhile PM2.5 has been shown to impair cognitive function, physical activity (PA) is known to enhance it. Nonetheless, considering the increased inhalation of PM2.5 during exercise, the potential of PA to counteract the detrimental effects of PM2.5, along with the underlying hemodynamic mechanisms, remains uncertain. MethodsWe conducted a double-blinded, randomized controlled trial among healthy young adults in Beijing, China. Ninety-three participants were randomly allocated to groups experiencing different intensities of PA interventions, and either subjected to purified or unpurified air conditions. Cognitive function was measured by the Color-Word Matching Stroop task, and the hemodynamic response was measured using functional near-infrared spectroscopy during participants performed the Stroop task both before and after the intervention. Linear mixed-effect models were used to estimate the impact of PA and PM2.5 on cognitive function and hemodynamic response. ResultsThe reaction time for congruent and incongruent Stroop tasks improved by − 80.714 (95% CI: −136.733, −24.695) and − 105.843 (95% CI: −188.6, −23.085) milliseconds after high-intensity interval training (HIIT) intervention. PM2.5 and HIIT had interaction effects on cognition, such that every 1 μg/m3 increase in PM2.5 attenuated the benefits of HIIT on reaction time by 2.231 (95% CI: 0.523, 3.938) and 3.305 (95% CI: 0.791, 5.819) milliseconds for congruent and incongruent Stroop tasks. Moreover, we divided participants into high and low PM2.5 exposure groups based on average PM2.5 concentration (32.980 μg/m3), and found that HIIT intervention in high PM2.5 concentration led to 69.897 (95% CI: 9.317, 130.476) and 99.269 (95% CI: 10.054, 188.485) milliseconds increased in the reaction time of congruent and incongruent Stroop, compared with the control group among low PM2.5. Furthermore, we found a significant interaction effects of PM2.5 and moderate-intensity continuous training (MICT) on the middle frontal gyrus (MFG) and dorsolateral superior frontal gyrus (DLPFC). PM2.5 and HIIT had a significant interaction effect on the DLPFC. ConclusionsHIIT improved cognitive function, but the cognitive benefits of HIIT were attenuated or even reversed under high PM2.5 exposure. The activation of the DLPFC and MFG could serve as hemodynamic mechanisms to explain the joint effect of PA and PM2.5.