This study aims to optimize daily forecasts of the PM2.5 concentrations in Dakar, Senegal using a long short-term memory (LSTM) neural network model. Particulate matter, aggravated by factors such as dust, traffic, and industrialization, poses a serious threat to public health, especially in developing countries. Existing models such as the Autoregressive integrated moving average (ARIMA) have limitations in capturing nonlinear relationships and complex dynamics in environmental data. Using four years of daily data collected at the Bel Air station, this study shows that the LSTM neural network model provides more accurate forecasts with a root mean square error (RMSE) of 3.2 μg/m3, whereas the RMSE for ARIMA is about 6.8 μg/m3. The LSTM model predicts reliably up to 7 days in advance, accurately reproducing extreme values, especially during dust event outbreaks and peak travel periods. Computational analysis shows that using Graphical Processing Unit and Tensor Processing Unit processors significantly reduce the execution time, improving the model efficiency while maintaining high accuracy. Overall, these results highlight the usefulness of the LSTM network for air quality prediction and its potential for public health management in Dakar.