Focusing on the construction of the National Big Data Comprehensive Pilot Zone (NBDCPZ), we adopted the difference-in-differences model to examine the impact of big data on green total factor productivity (GTFP), using data from 276 cities in China for the period of 2012 to 2019. We also conducted mediating effects and moderating effects tests to explore whether a factor exists through which, or relying on it, big data influences the GTFP. The result of the baseline regression showed that the construction of the NBDCPZ significantly increased GTFP. After a series of robustness tests, this conclusion remains valid. In addition, we examined the mediating effects of industrial structure and green innovation and found that the construction of the NBDCPZ increased the level of GTFP, mainly by promoting industrial structure upgrading and green innovation activities. We identified the moderating effects of different types of environmental regulation on the relationship between urban digital transformation and GTFP and found that market incentive environmental regulation (MIER) has a significant positive moderating effect on big data increasing GTFP. Conversely, the moderating effects of command and control environmental regulation (CCER) and social participation environmental regulation (SPER) were found to be insignificant. These findings suggest that urban digital transformation, through its contribution to increasing GTFP, is an important pathway to high-quality development.