Previous studies have examined the innovation effect of corporate social responsibility (CSR) by measuring R&D investment or patent output, and there are still different opinions. Using the data of Chinese listed companies, we analyse the influence of CSR on innovation and its mechanism. We find that the active fulfillment of CSR is beneficial to the improvement of the scale and quality of innovation. The mechanism test shows that undertaking more CSR enables enterprises to obtain more financial subsidies, which promotes the improvement of innovation scale and quality. In addition, media attention reinforces the innovative effect of CSR. Heterogeneity research shows that for non-state-owned enterprises (non-SOEs) and enterprises located in areas with imperfect market mechanisms, actively assuming CSR is conducive to improving innovation performance. However, for SOEs and enterprises located in areas with mature market mechanisms, the innovative effect of CSR is not significant.