The intricate and multifaceted nature of soil system profoundly influences the highly complex and often nonlinear changes that soil heavy metals (HM) undergo. Spatial heterogeneity, location and scale variability, and the interaction and superposition among environmental drivers challenged researchers to determine the sophisticated nature of soil HMs changes at the regional scale. This study aims to develop a new method framework and selects Ningbo as the case study to apportion the environmental factors responsible for soil HMs pollution that include Cd, Cr, Pb, Hg, As, Cu, Zn and Ni, focusing on nonlinearity and interaction. We harnessed the Random Forest model to apportion the environmental drivers of soil HM change. The directionality and shape of the nonlinear relationship between HMs and their individual contributors were derived by Partial Dependence Plots. The interactions of multiple drivers were quantitatively assessed by the Conditional Inference Tree. Our results demonstrated that soil HMs in the study area varied spatially. Soil HMs pollution was mitigated by natural factors and anthropogenic factors. The main influencing factors were pH, soil parent material type, enterprise activities, and agricultural application. The effects of some factors on soil HMs showed a monotonic linear trend, but some have apparent threshold effects. The direction of influence on soil HMs will shift when pH and phosphate fertilizer reach a specific value. The addition of enterprises in the area would rarely have an impact on the HMs pollution once it reached around 2 per km2 because of the industrial agglomeration. Soil HM concentrations were mainly from multi-pollutants and were governed by a combination of environmental factors. Our study provided managers and policymakers with site-specific and definite guidelines for preventing and controlling soil HM pollution.