In many emerging nations, rapid industrialization and urbanization have led to heightened levels of air pollution. This sudden rise in air pollution, which affects global sustainability and human health, has become a significant concern for citizens and governments. While most current methods for predicting air quality rely on shallow models and often yield unsatisfactory results, our study explores a deep architectural model for forecasting air quality. We employ a sophisticated deep learning structure to develop an advanced system for ambient air quality prediction. We utilize three publicly available databases and real-world data to obtain accurate air quality measurements. These four datasets undergo a data cleaning to yield a consolidated, cleaned dataset. Subsequently, the Fused Eurasian Oystercatcher-Pathfinder Algorithm (FEO-PFA)—a dual optimization method combining the Eurasian Oystercatcher Optimizer (EOO) and Pathfinder Algorithm (PFA)—is applied. This method aids in selecting weighted features, optimizing weights, and choosing the most relevant attributes for optimal results. These optimal features are then incorporated into the Multiscale Depth-wise Separable Adaptive Temporal Convolutional Network (MDS-ATCN) for the ambient Air Quality Prediction (AQP) process. The variables within MDS-ATCN are further refined using the proposed FEO-PFA to enhance predictive accuracy. An empirical analysis is performed to compare the efficacy of our proposed model with traditional methods, underscoring the superior effectiveness of our approach. The average cost function is reduced to 5.5%, the MAE to 28%, and the RMSE to 14% by the suggested method, according to the performance research conducted with regard to all datasets.