This study analyzes the influence of urban digital economy development on enterprise ESG performance in China and its enterprise innovation channels. Based on matching micro-level data of enterprises and macro-level data of prefecture-level cities from 2012 to 2020, this study uses OLS to conduct empirical estimation and uses a multiple mediation effect model to test the influencing mechanism. Our findings demonstrate that the development of an urban digital economy significantly improves enterprise ESG performance in China. Additionally, the development of the digital economy can boost enterprise ESG performance by enhancing innovation input intensity, improving innovation output capacity, and enhancing innovation input intensity to improve innovation output capacity. Furthermore, we find that the development of the digital economy in eastern and northeastern China significantly improves enterprise ESG performance, urban agglomerations play a central role in the process of digital economy development improving enterprise ESG performance, and the development of the digital economy significantly enhances enterprise ESG performance in younger enterprises. Overall, our findings improve and enrich the research on the digital economy and enterprise development from the perspective of micro-enterprises and macro development. Moreover, they provide theoretical support and empirical evidence for the development of the digital economy and the realization of enterprises’ sustainable development.