Drylands, which account for 41% of Earth’s land surface and are home to more than two billion people, play an important role in the global carbon balance. This study analyzes the spatio-temporal patterns of vegetation carbon sinks and sources in the arid region of northwest China (NWC), using the net ecosystem production (NEP) through the Carnegie–Ames–Stanford approach (CASA). It quantitatively evaluates regional ecological security over a 20-year period (2000–2020) via a remote sensing ecological index (RSEI) and other ecological indexes, such as the Normalized Difference Vegetation Index (NDVI), fraction of vegetation cover (FVC), net primary productivity (NPP), and land use. The results show that the annual average carbon capacity of vegetation in NWC changed from carbon sources to carbon sinks, and the vegetation NEP increased at a rate of 1.98 gC m−2 yr−1 from 2000 to 2020. Spatially, the annual NEP in northern Xinjiang (NXJ), southern Xinjiang (SXJ) and Hexi Corridor (HX) increased at even faster rates of 2.11, 2.22, and 1.98 gC m−2 yr−1, respectively. Obvious geographically heterogeneous distributions and changes occurred in vegetation carbon sinks and carbon sources. Some 65.78% of the vegetation areas in NWC were carbon sources during 2000–2020, which were concentrated in the plains, and SXJ, the majority carbon sink areas are located in the mountains. The vegetation NEP in the plains exhibited a positive trend (1.21 gC m−2 yr−1) during 2000–2020, but this speed has slowed since 2010. The vegetation NEP in the mountain exhibited only intermittent changes (2.55 gC m−2 yr−1) during 2000–2020; it exhibited a negative trend during 2000–2010, but this trend has reversed strongly since 2010. The entire ecological security of NWC was enhanced during the study period. Specifically, the RSEI increased from 0.34 to 0.49, the NDVI increased by 0.03 (17.65%), the FVC expanded by 19.56%, and the NPP increased by 27.44%. Recent positive trends in NDVI, FVC and NPP have enhanced the capacity of vegetation carbon sinks, and improved the eco-environment of NWC. The scientific outcomes of this study are of great importance for maintaining ecological stability and sustainable economic development along China’s Silk Road Economic Belt.