Transportation is widely recognized as a significant contributor to heavy metal (HM) pollution in roadside soils. A better understanding of HM pollution in soils near expressways is crucial, particularly given the rapid expansion of expressway transportation in China in recent years. In this study, 329 roadside topsoil samples were collected along the Beijing-Tianjin Expressway, which connects two megacities in China. Chemical analysis showed that HM concentrations in the soil samples were generally below national limits. The mean pollution index (Pi) values for As, Cr, Cu, Ni, Pb, and Zn ranged from 0.94 to 1.01, while Cd and Hg exhibited slightly higher mean Pi values of 1.19 and 1.13, respectively. The Nemerow integrated pollution index values for all samples ranged from 0.71 to 4.97, with a mean of 1.26. This suggests a slight enrichment of HM above natural background levels, especially for Cd and Hg. Source apportionment using positive matrix factorization revealed that natural sources contributed the most to soil HMs (64.51 %), followed by agricultural sources (19.15 %), traffic sources (9.77 %), and industrial sources (6.57 %). The Shapley additive explanation analysis, based on the random forest model, identified soil organic carbon, deep soil HM content, altitude, total soil K2O, urbanization composite impact index, and total soil P as primary influencing factors. This indicates that the impact of transportation on roadside soils along the Beijing-Tianjin Expressway is currently relatively limited. The prominent influence of soil properties and altitude underscored the importance of "transport" and "receptor" in the soil HMs accumulation process at the local scale. These findings provide critical data and a scientific basis for decision-makers to develop policies for expressway design and roadside soil protection.