Heavy metals were discharged into the agricultural soil through coal mining, transportation, etc., posing a threat to human health through the food chain. In order to investigate the sources of heavy metals and potential risk to the population, we collected 298 surface soil samples in the black soil area of Sanjiang Plain in Heilongjiang province and tested the concentrations of seven heavy metals. Toxic element contamination in the soil was evaluated by combining the potential ecological risk index and environmental capacity, and pollution sources are identified through positive matrix factorization. The results indicate that the concentrations of Cd and As exceed background values by 1.74 and 1.51 times, respectively, and the ecological risk of Cd is significantly higher than those of other toxic elements. The comprehensive ecological risk level is a moderate comprehensive ecological risk level at 78.5% and a low comprehensive ecological risk level at 21.5%. The sources of heavy metal elements include pesticide spraying (36.5%), input fertilizer and transport activities (20.5%), and mining and metallurgy-related activities (43.1%). When linking the PMF to the Human Health Risk Assessment model, it was found that about 56% of the samples pose a carcinogenic risk to children. Knowledge of soil pollution can certainly help to understand the sources of toxic elements and the health risks to people in the black soil area and provide a scientific basis for the prevention of heavy metal pollution.