The impact of carbon fluxes on soil organic carbon (SOC) remains underexplored. We employed machine learning to model SOC dynamics. Our findings project an increase in China’s SOC through to the year 2100 across various Shared Socioeconomic Pathways. Sensitivity analyses have identified carbon fluxes as the main drivers for this projected rise, followed by climate and land use. Further examination using an explainable artificial intelligence method, Shapley Additive Explanations, has uncovered both spatial and temporal variations in how gross primary production (GPP) influences SOC levels. Notably, GPP’s contribution on SOC is initially negative at low levels, turning positive once a threshold of approximately 3 gC m-2d-1 is surpassed. Beyond a GPP of about 7 gC m-2d-1, its positive contribution to SOC plateaus. Critical zones for soil carbon sequestration are located around 400 mm annual precipitation line.