As a high-risk industry, coal mine safety accidents can create significant loss of life and property to the nation and its people. In this work, a nonlinear time-varying factor model was adopted to investigate the spatial and temporal variation rule of coal mine safety accidents and coal production in 23 provinces of China from 2005 to 2021. The driving factors of coal mine safety accidents in 2005, 2010, 2015 and 2020 were analyzed using the geographical detector method. We further obtained the explanatory power of the primary factors and the change process of interaction. The findings showed that there are convergence clubs for both the number of coal mine safety accidents and coal production in the Chinese provinces. However, the geographical distribution of the convergence clubs varied. The geographical detector results indicated that coal mine safety accidents are affect by a combination of factors. The explanatory power of each factor for coal mine safety accidents changed over time. Notably, the explanatory power of coal production for coal mine safety accidents decreased. Industry structure, salary, security inputs, coal consumption and gross domestic product (GDP) played a significant role. The lever of impact of each factor on coal mine safety accidents was enhanced after interaction. The relationship between the factors entailed nonlinear enhanced interaction. The research findings not only contribute to a greater understanding of the macroscopic patterns of accident occurrence but also increase the awareness of the government and enterprises regarding the driving factors of coal mine safety accidents. Furthermore, such research holds crucial significance for precise prevention and control of coal mine safety accidents.