This study conducts theoretical and empirical analyses of the dynamic effects, mediating mechanisms, and heterogeneity associated with the construction of green data centers to promote urban digital economic growth. It employs a green data center pilot implemented by the Chinese government in 2015 as a quasi-experiment and applies a dual machine learning method using panel data from 288 prefecture-level cities in China between 2011 and 2022. The findings indicate that the establishment of green data centers has a significant positive impact on urban digital economic development. This effect is particularly pronounced in cities characterized by high levels of digital engagement, net population inflow, non-resource-based economies, non-industrial profiles, and strong environmental protection initiatives. The key mediating mechanisms include digital industry agglomeration, green technological innovation, and industrial structure upgrading. Furthermore, the influence of the construction of green data centers on the digital economy exhibits a " siphon effect" within distances of 0-150 km and "spillover effect" extending up to 200 km. This study enriches the existing literature on urban digital economies and provides important theoretical and practical implications for advancing the synergistic transformation between urban digitalization and greenization.