Introduction: Traditional statistical methods cannot find quantitative relationship from environmental data.Methods: We selected gene expression programming (GEP) to study the relationship between pollutant gas and PM2.5 (PM10). They were used to construct the relationship between pollutant gas and PM2.5 (PM10) with environmental monitoring data of Xi’an, China. GEP could construct a formula to express the relationship between pollutant gas and PM2.5 (PM10), which is more explainable. Back Propagation neural networks (BPNN) was used as the baseline method. Relevant data from January 1st 2021 to April 26th 2021 were used to train and validate the performance of the models from GEP and BPNN.Results: After the models of GEP and BPNN constructed, coefficient of determination and RMSE (Root Mean Squared Error) are used to evaluate the fitting degree and measure the effect power of pollutant gas on PM2.5 (PM10). GEP achieved RMSE of [8.7365–14.6438] for PM2.5; RMSE of [13.2739–45.8769] for PM10, and BP neural networks achieved average RMSE of [13.8741–34.7682] for PM2.5; RMSE of [29.7327–52.8653] for PM10. Additionally, experimental results show that the influence power of pollutant gas on PM2.5 (PM10) situates between −0.0704 and 0.6359 (between −0.3231 and 0.2242), and the formulas are obtained with GEP so that further analysis become possible. Then linear regression was employed to study which pollutant gas is more relevant to PM2.5 (PM10), the result demonstrates CO (SO2, NO2) are more related to PM2.5 (PM10).Discussion: The formulas produced by GEP can also provide a direct relationship between pollutant gas and PM2.5 (PM10). Besides, GEP could model the trend of PM2.5 and PM10 (increase and decrease). All results show that GEP can be applied smoothly in environmental modelling.