During 2020, the COVID-19 pandemic resulted in a widespread lockdown in many cities in China. In this study, we assessed the impact of changes in human activities on air quality during the COVID-19 pandemic by determining the relationships between air quality, traffic volume, and meteorological conditions. The megacities of Wuhan, Beijing, Shanghai, and Guangzhou were selected as the study area, and the variation trends of air pollutants for the period January–May between 2016 and 2020 were analyzed. The passenger volume of public transportation (PVPT) and the passenger volume of taxis (PVT) along with data on precipitation, temperature, relative humidity, wind speed, and boundary layer height were used to identify and quantify the driving force of the air pollution variation. The results showed that the change rates of fine particulate matter (PM2.5), NO2, and SO2 before and during the lockdown in the four megacities ranged from −49.9% to 78.2% (average: −9.4% ± 59.3%), −55.4% to −32.3% (average: −43.0% ± 9.7%), and − 21.1% to 11.9% (average: −10.9% ± 15.4%), respectively. The response of NO2 to the lockdown was the most sensitive, while the response of PM2.5 was smaller and more delayed. During the lockdown period, haze from uninterrupted industrial emissions and fireworks under the effect of air mass transport from surrounding areas and adverse climate conditions was probably the cause of abnormally high PM2.5 concentrations in Beijing. In addition, the PVT was the most significant factor for NO2, and meteorology had a greater impact on PM2.5 than NO2 and SO2. There is a need for more national-level policies for limiting firework displays and traffic emissions, as well as further studies on the formation and transmission of secondary air pollutants.