Clean air is critical component for health and survival of human and wildlife, as atmospheric pollution is associated with a number of significant diseases including cancer. However, due to rapid industrialization and population growth, activities such as transportation, household, agricultural, and industrial processes contribute to air pollution. As a result, air pollution has become a significant problem in many cities, especially in emerging countries like India. To maintain ambient air quality, regular monitoring and forecasting of air pollution is necessary. For that purpose, machine learning has emerged as a promising technique for predicting the Air Quality Index (AQI) compared to conventional methods. Here we apply the AQI to the city of Visakhapatnam, Andhra Pradesh, India, focusing on 12 contaminants and 10 meteorological parameters from July 2017 to September 2022. For this purpose, we employed several machine learning models, including LightGBM, Random Forest, Catboost, Adaboost, and XGBoost. The results show that the Catboost model outperformed other models with an R2 correlation coefficient of 0.9998, a mean absolute error (MAE) of 0.60, a mean square error (MSE) of 0.58, and a root mean square error (RMSE) of 0.76. The Adaboost model had the least effective prediction with an R2 correlation coefficient of 0.9753. In summary, machine learning is a promising technique for predicting AQI with Catboost being the best-performing model for AQI prediction. Moreover, by leveraging historical data and machine learning algorithms enables accurate predictions of future urban air quality levels on a global scale.