Groundwater discharge to headwater streams and concomitant terrestrially derived CO2 input play a key role in stream CO2 evasion. However, previous studies rarely examined the transport and transformation of terrestrially derived CO2 in headwater streams, thereby limiting our understanding of stream CO2 evasion. Here, we firstly used a numerical flow model to quantify groundwater discharge rates along a 43 km headwater stream (semiarid northwest China) by combining stream flow rate, radon-222 isotopic data, and then estimated internal metabolism through a reach-scale dissolved O2 mass balance and carbonate buffering through carbon budget for the stream. Modeling results indicate that groundwater discharge rates were highly variable (2.17–7.03 m2 d−1, mean ± 1 standard deviation: 4.48 ± 1.25 m2 d−1). Groundwater was supersaturated with CO2 at all sites (5.45 ± 3.87 mg C L−1). Our results also show that diffuse groundwater discharge was a major control on terrestrial carbon input to the stream. Terrestrial CO2 input (3.92 ± 2.03 g C m−2 d−1) contributed more CO2 to the stream than internal metabolism (1.74 ± 2.33 g C m−2 d−1). However, most terrestrially derived CO2 was transformed into HCO3− through carbonate buffering after entering the stream, inhibiting stream CO2 evasion. This carbonate buffering process depends on the hydrochemistry and proportion of mixing waters. Overall, our study provides a bottom-up and holistic perspective to understand the transport and transformation of terrestrially derived CO2 in headwater streams.