This study examines the effect of COVID-19 control policies on air quality in Shanghai, focusing on Air Quality Index (AQI) levels during and after lockdowns using gradient boosting models. The aim was to analyze air quality variations by comparing predicted and observed data from different lockdown phases to assess the impact of reduced human activities on air pollution. The findings reveal that air quality deteriorated post-strict lockdown due to increased activities. However, predictions for periods during the strict lockdown and after the general lockdown did not always match expectations, indicating that factors beyond reduced human activities could influence air quality. This underscores the complexity of air quality prediction and the need for further research incorporating a wider range of variables, including non-numeric features and external environmental factors. The study contributes to understanding the nuanced relationship between pandemic control measures and air pollution, highlighting the challenges in accurately predicting air quality outcomes and the potential for policy-driven environmental improvements.