Digital transformation enables small and medium enterprises (SMEs) to reduce or overcome their reliance on resources and energy, thereby minimizing their environmental impact and providing them with sustainable green competitive advantages. However, the reasons for this phenomenon are not yet clear. To further investigate this issue, we selected 391 Chinese SMEs to examine the relationships among green transformation, green innovation, government regulation, and green competitive advantages. Green innovation includes green product innovation and green process innovation, while government regulation includes incentive regulation, constraint regulation, and guidance regulation. The empirical results show that digital transformation can enhance SMEs’ green competitive advantages. Additionally, the hypothesized mediating effect of green product innovation and green process innovation between digital transformation and green competitive advantages is supported, while the moderating effect of incentive regulation, constraint regulation, and guidance regulation on the relationship between digital transformation and green product innovation and green process innovation is also confirmed. The findings of this study may contribute to more effective management of digital transformation and green innovation in SMEs, thereby promoting their development.