In recent years, green, low carbon and sustainable development has become a common topic of concern. Aiming at solving the drawback of low accuracy of PM2.5 concentration prediction, this paper proposes a method based on deep learning to predict PM2.5 concentration. Firstly, we comprehensively consider various meteorological elements such as temperature, relative humidity, precipitation, wind, visibility, etc., and comprehensively analyze the correlation between meteorological elements and PM2.5 concentration. Secondly, the time series data of PM2.5 concentration monitoring stations are used as the reference sequence and comparison sequence in the gray correlation analysis algorithm to construct the spatial weight matrix, and the spatial relationship of the original data is extracted by using the spatial weight matrix. Finally, we combine the forgetting and input threshold to synthesize the updated threshold, merge the unit state and the hidden state, and use the Gate Recurrent Unit (GRU) as the core network structure of the recurrent neural network. Compared with the traditional LSTM model, the GRU model is simpler. In terms of convergence time and required epoch, GRU is better than the traditional LSTM model. On the basis of ensuring the accuracy of the model, the training time of the model is further reduced. The experimental results show that the root mean square error and the average absolute error of this method can reach 18.32 ug · m−3 and 13.54 ug · m−3in the range of 0–80 h, respectively. Therefore, this method can better characterize the time series characteristics of air pollutant changes, so as to make a more accurate prediction of PM2.5 concentration.