Dinitrogen pentoxide (N2O5) plays an essential role in tropospheric chemistry, serving as a nocturnal reservoir of reactive nitrogen and significantly promoting nitrate formations. However, identifying key environmental drivers of N2O5 formation remains challenging using traditional statistical methods, impeding effective emission control measures to mitigate NOx-induced air pollution. Here, we adopted machine learning assisted by steady-state analysis to elucidate the driving factors of N2O5 before and during the 2022 Winter Olympics (WO) in Beijing. Higher N2O5 concentrations were observed during the WO period compared to the Pre-Winter-Olympics (Pre-WO) period. The machine learning model accurately reproduced ambient N2O5 concentrations and showed that ozone (O3), nitrogen dioxide (NO2), and relative humidity (RH) were the most important driving factors of N2O5. Compared to the Pre-WO period, the variation in trace gases (i.e., NO2 and O3) along with the reduced N2O5 uptake coefficient was the main reason for higher N2O5 levels during the WO period. By predicting N2O5 under various control scenarios of NOx and calculating the nitrate formation potential from N2O5 uptake, we found that the progressive reduction of nitrogen oxides initially increases the nitrate formation potential before further decreasing it. The threshold of NOx was approximately 13 ppbv, below which NOx reduction effectively reduced the level of night-time nitrate formations. These results demonstrate the capacity of machine learning to provide insights into understanding atmospheric nitrogen chemistry and highlight the necessity of more stringent emission control of NOx to mitigate haze pollution.