To understand the pollution status, distribution characteristics, and pollution sources of soil heavy metals in tourist cities in northwest China, the soil content of heavy metals As, Cd, Cr, Cu, Hg, Ni, Pb, and Zn in the main areas of Dunhuang City was collected and analyzed. The soil heavy metal pollution level was quantitatively evaluated by the methods of the geo-accumulation index and improved Nemerow pollution index, and the sources of heavy metal pollution were quantitatively analyzed using cluster analysis and the positive matrix factorization (PMF) model. The contribution rate of each pollution source to ecological risk was determined by combining the PMF model and comprehensive ecological risk index. The results showed that except for the mean contents of As and Ni, the mean contents of Cd, Cr, Cu, Hg, Pb, and Zn were all higher than the background values in Gansu Province. However, the average content of the eight elements was lower than the screening value of construction land in the Standard for Soil Pollution Risk Control of Soil Environmental Quality Construction Land (trial) (GB 36600-2018). Among them, the enrichment of Cd, Pb, and Hg was more serious, and the exceedance rate was higher than 90%. The results of the geo-accumulation index indicated that urban soils were mainly polluted by Hg in the study area, and Cd, Cr, Cu, Pb, and Zn pollution also existed in different degrees. The improved Nemerow pollution index illustrated that the comprehensive pollution degree of the soil was clean to moderate pollution, and the overall pollution was light pollution. Based on the PMF model, we could conclude that soil heavy metals in the study area were affected by natural sources, industrial deposition sources, industrial sources, traffic sources, and comprehensive sources, and the contribution rates were 29.28%, 25.86%, 20.13%, 16.5%, and 8.23%, respectively. The specific source-integrated ecological risk assessment model found that the industrial deposition source contributed the most to the ecological risk in the study area and could be regarded as the priority control pollution source, and Hg was considered to be the priority control pollution element for ecological risk.