The dynamics of soil organic carbon (SOC) play a critical role in modulating global warming. However, the long-term spatiotemporal changes of SOC at large scale, and the impacts of driving forces remain unclear. In this study, we investigated the dynamics of SOC in different soil layers across China through the1980s to 2010s using a machine learning approach and quantified the impacts of the key factors based on factorial simulation experiments.Our results showed that the latest (2000-2014) SOC stock in the first meter soil (SOC100 ) was 80.68 ± 3.49 Pg C, of which 42.6% was stored in the top 20 cm, sequestrating carbon with a rate of 30.80 ± 12.37 g C m-2 yr-1 since the 1980s. Our experiments focusing on the recent two periods (2000s and 2010s) revealed that climate change exerted the largest relative contributions to SOC dynamics in both layers and warming or drying can result in SOC loss. However, the influence of climate change weakened with soil depth, while the opposite for vegetation growth. Relationships between SOC and forest canopy height further confirmed this strengthened impact of vegetation with soil depth and highlighted the carbon sink function of deep soil in mature forest. Moreover, our estimates suggested that SOC dynamics in 71% of topsoil were controlled by climate change and its coupled influence with environmental variation (CE). Meanwhile, CE and the combined influence of climate change and vegetation growth dominated the SOC dynamics in 82.05% of the first meter soil. Additionally, the national cropland topsoil organic carbon increased with a rate of 23.6 ± 7.6 g C m-2 yr-1 since the 1980s, and the widely applied nitrogenous fertilizer was a key stimulus. Overall, our study extended the knowledge about the dynamics of SOC and deepened our understanding about the impacts of the primary factors.