In desert ecosystems, afforestation with xerophytic shrubs has the potential to significantly increase soil nutrient levels by mitigating wind and soil erosion. Nevertheless, further investigation is required to elucidate the changes in soil organic carbon (SOC) fractions and stability on different soil depths with afforestation years. We collected soil samples from the 0–20, 20–60, and 60–100 cm depths of three xerophytic shrublands ages (3, 7, and 10 years), with a natural desert as the control, in a hyper‐arid desert region. We investigated the variations of SOC fractions (stable and active C) and stability (stability index and MAOC:POC ratios) after afforestation. The results showed that the rate of increase in SOC fractions and stability did not follow a linear trajectory with afforestation years. Instead, they accelerated around 7 years but then decreased after 10 years. The increase in SOC stability was primarily attributed to the greater increase in stable C within the total SOC pool. Afforestation increased the concentration of ROC from 0.26 to 0.89 g kg−1 and MAOC from 0.11 to 0.78 g kg−1. Afforestation increased SOC stability by 74.36%–231% compared to the CK in the 0–100 cm. SOC stability in the 60–100 cm was higher than that in the 0–20 cm layer, while SOC stability varied insignificantly across soil layers. The strongest direct positive impact on SOC stability was attributed to changes in soil physicochemical properties rather than soil microbial biomass or aggregate stability. These findings contribute to our understanding of the importance of afforestation in increasing SOC stability in desert ecosystems.