This study aims to investigate the effect of enterprise digital transformation on green investment based on data from Chinese A-share listed enterprises from 2008 to 2021. The result suggests that enterprise digital transformation has a significant contribution to green investment, and this finding still holds after a series of robustness tests. Digital transformation promotes green investment by improving internal control quality, increasing information transparency and ESG performance. We further find that the differences in firm characteristics and external environment also make the impact of digital transformation on enterprise green investment varied. Specifically, the promotion effect of digital transformation on green investment is greater in enterprises with low financing constraints, low risk enterprises and enterprises in the growth stage, and also greater in regions with developed digital financial inclusion and high government support and strong environmental regulation. Our findings provide empirical insights for understanding how enterprises engage in environmental governance in the context of rapidly growing digital economy.