To investigate the impact of pyrite mining on the heavy metal pollution in the surrounding soil in Tongling City, 50 surface soil and sediment samples were collected from mining fields, farmland, forests, villages, and the river. The contents of Zn, Cr, Cu, Pb, Ni, Cd, and As in soils and sediments were analyzed. Then, the spatial distribution characteristics of heavy metals in soil were analyzed, and the degree of heavy metal pollution and potential ecological risk level were assessed. Finally, the sources of soil heavy metal pollution were identified. In general, the soil in the study area was weakly acidic (average pH=6.32), and the contents of other heavy metals except Ni exceeded the background values of the soil in Tongling City. Moreover, Ni and Cd were enriched in the river sediments. According to the Nemerow pollution index, Pb and As reached heavy pollution levels, Cu and Cd reached moderate pollution levels, and other elements belonged to light or non-pollution levels. The comprehensive pollution index of different land types was ranked in the order of mining field > river > forest > farmland > village. Mining fields and the river were heavily polluted, forest land was moderately polluted, and farmland and villages were mainly mildly polluted. Pb, As, and Cd belonged to the medium ecological risk category. The contribution rates of the potential ecological risk index were 33.27%, 27.39%, and 20.22%, which were much higher than the other four elements. The ranking results of the potential ecological risk index of different land types was the same as that of the comprehensive pollution index. Mining fields and the river were at a high-risk level, forest land reached moderate risk, and the rest were at a slight risk level. The consistent results of correlation analysis, principal component analysis (PCA), and positive definite matrix factor analysis (PMF) indicated that Zn, Cu, Pb, Cd, and As were mainly derived from pyrite mining activities, Cr mainly came from the parent material and agricultural production, and Ni was mainly affected by soil-forming parent material and pyrite mining activities.