The soil environment plays an important role in urban ecosystems. To study the heavy metal contamination of soil in Beilun District, Ningbo, we collected soil samples from 60 points in urban and peri-urban areas of Beilun District and analyzed the spatiotemporal variation and sources of heavy metal pollution in various land-use types. The contents of heavy metals in green belts and woodland in 2022 were higher than those in 2015, while there was no significant change in agricultural land. The heavy metal contents in both years were mainly in the order green belts > agricultural land > woodland. The spatiotemporal analysis showed that heavy metal pollution in Beilun District was concentrated in five industrial areas, and there was a trend toward the disappearance of highly polluted points. The single-factor pollution index, pollution load index (PLI), and geoaccumulation index (Igeo) indicated that there was no significant heavy metal pollution in Beilun District, and individual elements at specific points showed slight pollution. The source analysis results showed that the main source of Hg is chemical, As is mainly derived from agricultural, Cr, Ni and Cu are mainly derived from natural, the main sources of Zn and Cd are electroplating and machinery activities, and the main source of Pb is traffic. This results specify a reference for future investigation on urban soil heavy metals, and the source apportionment results provide a scientific foundation for subsequent soil heavy metal pollution treatment.