Human activities constantly produce air pollutants, which may greatly impact climate change. Elucidating the relationship between air quality and temperature change is essential to gain a better understanding of climate change. Up until now, machine learning algorithms have been deployed to big data analysis in various fields. Here, we use the machine learning algorithms to analyze temperature and air quality data of different cities across China. Multiple linear regression and tree-based methods, including bagging, boosting and random forest, are used to train the model. With the tree-based methods, the factors highly associated with temperature change will be elucidated, which indicate their significant impact on temperature change. The results in this study demonstrate the possibility of using machine learning in atmospheric science field to predict air quality and temperature change, and how different algorithms perform regarding temperature and air quality predictions, which is informative for future air quality prediction research. The relationship between air quality and temperature change can also provide guidance to policymakers.