Based on the perspective of industrial agglomeration, this paper employs a dynamic panel model and mediating effects model to investigate the impact of digital economy’s development on air pollution in 274 Chinese cities from 2011 to 2019. The main findings include: (1) The development of the digital economy reduces air pollution emissions in Chinese cities, and the elasticity of pollution reduction is greater in central and western China than in eastern China. (2) The nexus between industrial agglomeration and air pollution is inverted-N-shaped. (3) Mechanism tests show that the digital economy can effectively promote the degree of industrial agglomeration in each area, and it plays a positive role in abating pollution in eastern and central China through the positive externalities of industrial agglomeration, but the mediating effect of industrial agglomeration on pollution reduction is not significant in western China. (4) Diversified agglomeration is an active mediator of the digital economy’s pollution reduction effect in eastern and central China. Accordingly, some policy implications are put forward for simultaneously promoting the development of the digital economy and reducing air pollution, impelling industrial agglomeration, and accelerating the green transformation in China.