In the context of increasing urban pollution and its adverse health effects, this study focuses on enhancing the air quality prediction model by forecasting future concentrations of various Air Quality Index (AQI) levels to support the development of green smart cities. The primary objective of this study is to develop a robust multivariate time series forecasting model using a combination of Convolutional Neural Networks (CNN) and Customized Stacked-based Long Short-Term Memory (CSLSTM) networks, namely C2SLSTM. The proposed methodology involved preprocessing AQI and meteorological data, scaling the features, and employing a hybrid CNN-LSTM architecture to capture spatial and temporal dependencies in the data. Dynamic AQI pattern changes are computed using online learning. The proposed model was trained on a big dataset containing AQIs such as particulate matter (PM2.5), carbon monoxide (CO), and nitrogen dioxide (NO2), along with meteorological factors like weather count, temperature, wind, humidity, and pressure. Experimental results demonstrate that the model achieved a mean absolute error (MAE) of 0.25, mean square error (MSE) of 0.083, root mean square error (RMSE) of 0.289 and a R2-Score of 0.84 on the test set. Also, compared to Long Short-Term Memory (LSTM), Convolutional Neural Network (CNN), Stacked Long Short-Term Memory (SLSTM), and Multilayer Perceptron (MLP) models, the C2SLSTM model showcases a performance enhancement of 35 %, 50 %, 30 %, and 32 %. Notably, the CNN component effectively extracted spatial features, while the LSTM layers captured temporal patterns, leading to precise predictions. These results indicate that the proposed approach effectively captures temporal dependencies and improves forecasting performance, with R2-Score values tending towards 1 for 12-hour prediction intervals. This research demonstrates the potential of advanced SLSTM architectures in accurately predicting AQI metrics, which can aid in better environmental monitoring and management. Also, the spatiotemporal correlation analysis is done through the designed ir metric.