Forecasting of short-term air pollution caused by nitrogen dioxide is valuable for decision making about human health protection. Open real world data collected in Madrid over a period from 2019 to 2022 were used. Trends and patterns in air pollution are presented and analysed. Causation between air pollution by nitrogen dioxide and traffic is investigated. Results of traffic forecasting obtained by corresponding bidirectional Long Short-Term Memory (LSTM) models at the selected stations as well as values of nitrogen dioxide concentration over historic horizon of 6 hours at the same station are used for forecasting of air pollution by nitrogen dioxide as features for LSTM models. Models were created and trained for each air pollution measurement station presented in the corresponding dataset. Forecasting is made for 6 hours ahead. The study confirmed that traffic forecasting results are valuable for models of forecasting air pollution by nitrogen dioxide. It provided increase in forecasting accuracy in comparison with the usage of historical values of traffic as input features. The obtained results improved MAE by 5 % and MSE by 6.37 % comparing to LSTM models with only previous values of air pollution by nitrogen dioxide. It defines an important approach which should be applied for more complex architectures of deep learning models in the following investigations.