To identify the sources of heavy metals in local soils and their risks to human health. This study quantified the concentrations of eight heavy metals in 504 soil samples collected in Tengzhou, China. The ecological risks of a single heavy metal (EI), a comprehensive ecological risk index (RI), and a health risk assessment model were used to evaluate the level of contamination in the city. The results of the research study indicate that there are different levels of heavy metal pollution in rural and urban agricultural areas in Tengzhou. Moreover, the spatial variability of mercury (Hg) is considerable, reaching 0.96, indicating a significant impact of anthropogenic activities. For the ecological risk, the heavy metal element with the highest EI value was mercury with a mean value of 67.22 and a peak value of 776.00. The heavy metal with the lowest mean EI value was Zn with only 1.03. Meanwhile, the average RI is only 128.59, but some areas have an RI as high as 842.2. The sources of heavy metals were identified using principal component analysis, correlation analysis, and an absolute principal component score multiple linear regression model (APCS-MLR). The non-carcinogenic risk for children, the carcinogenic risk for children, and the carcinogenic risk for adults were 1.23, 2.42×10-4 and 1.00×10-4, respectively, and these values exceeded their respective recommended values, and As and Cr had some carcinogenic hazards. Heavy metals in the soil come from natural, industrial, traffic and agricultural sources and represent 39.59%, 29.48%, 25.17% and 5.77%, respectively. The main source of heavy metals in local agricultural soils is the geological background, and the government needs to strengthen the monitoring of As and Cr in drinking water resources, as well as reduce traffic pollution and factory waste emissions to reduce Hg in soils.