The value created by enterprise digitalization is not only reflected in economic value but also has social and environmental value. Using data on A-share listed companies in Shanghai and Shenzhen from 2010 to 2020 as research samples, empirically tested the impact and mechanism of enterprise digital transformation on the environmental, social, and governance (ESG) performance. Overall, enterprise digital transformation can significantly improve the ESG performance of enterprises. Further, the mechanism testing shows that there are three main driving factors in promoting digital transformation: restraining the short-sightedness of management; improving the transparency of the internal information of enterprises; and improving the technological innovation of enterprises. The conclusion of the study enriches the strategic level of enterprise sustainable development from the perspective of “resource allocation”, and reveals the “black box” of the causal relationship between digital transformation and enterprise ESG performance.