Net primary productivity (NPP) is a crucial component of the terrestrial carbon cycle and plays a crucial role in assessing ecological security. Although machine learning models have been widely used in research on ecosystem modelling, however, the performance of deep learning models with interpretability in predicting NPP are still very limited. In this study, we developed an interpretable deep learning predictive model to uncover the historical drivers and future changes of NPP in China using remote sensing data, climate data and topography. The results show that more than three quarters (88 %) of China’s regional NPP have shown an increasing trend over the past 20 years, with an overall trend of 2.46 gC/m2/yr. This extensive range of dynamic processes is a nonlinear response to climatic conditions and topographic factors. The constructed convolutional neural network (CNN) model showed good predictive skill for historical NPP, and revealed that temperature is the main controlling factor, highlighting its importance in vegetation growth in China. Compared to the historical period (2001–2020), in the context of future climate change, the risk of carbon sinks decreasing in China is highly likely in the imminent near term (2021–2039), especially under high emission scenarios. These results suggest that interpretable deep learning method is a useful tool for revealing vegetation productivity drivers and estimating vegetation productivity under a nonstationary climate background.