This paper evaluates digital transformation's direct and indirect impacts on green innovation, covering data from Chinese-listed companies spanning 2012 to 2021. The results indicate that while the development of digital transformation among enterprises is relatively high, green innovation remains lower and has shown a downward trend during the pandemic. Meanwhile, their development levels are uneven across provinces. Importantly, our findings reveal that digital transformation can significantly promote green innovation. This positive impact varies significantly across size, ownership, and region. Furthermore, the paper employs a mediation model incorporating the instrumental variable approach to investigate the underlying mechanisms. The results confirm that R&D, ESG performance and financing constraints are significant mediating mechanisms through which digital transformation fosters green innovation. In enterprises with better corporate governance, reducing agency costs emerges as a crucial intermediary pathway for enhancing green innovation. The conclusions contribute to more scientific and practical decision-making references for enterprises and policymakers.