PM2.5 pollution in the atmosphere not only contaminates the environment but also seriously affects human health. Therefore, studying how to accurately predict future PM2.5 concentrations holds significant importance and practical value. This paper innovatively proposes a high-accuracy prediction model: RF-ICHOA-CNN-LSTM-Attention. First, the Random Forest (RF) model is utilized to evaluate the importance of air pollution and meteorological features and select more suitable input features. Subsequently, a one-dimensional convolutional neural network (1DCNN) with efficient feature extraction capability is used to extract dynamic features from sequences. The extracted feature vector sequences are then fed into a Long Short-Term Memory Network (LSTM). After the LSTM, an Attention Mechanism is incorporated to assign different weights to the input features, emphasizing the role of the important features. Additionally, the Improved Chimp Optimization Algorithm (IChOA) is employed to optimize the number of neurons in the two hidden layers of LSTM, the learning rate, and the number of training epochs. The experimental results on 12 test functions demonstrate that the optimization performance of IChOA is better than that of ChOA and the representative swarm optimization algorithms used for comparison. In the case of PM2.5 predictions in Yining and Beijing, experimental results show that the proposed model achieved the best performance in terms of RMSE, MAE, and R This indicates its excellent prediction accuracy and generalization capability, Thus proving its effectiveness in predicting PM2.5 concentration in the real world.