Existing studies on high-speed railway (HSR) and carbon dioxide (CO2) emissions have focused on analyzing their net effect, paying less attention to HSR’s impact mechanism on CO2 emissions. This paper investigates the influence and underlying mechanism of HSR on CO2 emissions. We apply a time-varying difference-in-differences approach to panel data from 283 cities in China between 2003 and 2016 to analyze HSR’s carbon-mitigation effects. A causal three-path mediation model and bootstrap method are utilized to analyze how HSR contributes to CO2 mitigation. The results show that HSR operations have significant carbon-mitigation effects, especially in the eastern regions and large cities of China. Moreover, the carbon-mitigation effect of HSR tends to amplify over time. Mechanism analysis showed that HSR’s carbon-mitigation effects are realized through four pathways: transportation substitution, economic agglomeration, industrial structuring, and technological innovation, with the last one contributing the most. This paper provides practical policy recommendations for the next phase of carbon governance in China.