Predicting soil heavy metal (HM) content is crucial for monitoring soil quality and ensuring ecological health. However, existing methods often neglect the spatial dependency of data. To address this gap, our study introduces a novel graph neural network (GNN) model, Multi-Scale Attention-based Graph Neural Network for Heavy Metal Prediction (MSA-GNN-HMP). The model integrates multi-scale graph convolutional network (MS-GCN) and attention-based GNN (AGNN) to capture spatial relationships. Using surface soil samples from the Pearl River Basin, we evaluate the MSA-GNN-HMP model against four other models. The experimental results show that the MSA-GNN-HMP model has the best predictive performance for Cd and Pb, with a coefficient of determination (R2) of 0.841 for Cd and 0.886 for Pb, and the lowest mean absolute error (MAE) of 0.403 mg kg−1 for Cd and 0.670 mg kg−1 for Pb, as well as the lowest root mean square error (RMSE) of 0.563 mg kg−1for Cd and 0.898 mg kg−1 for Pb. In feature importance analysis, latitude and longitude emerged as key factors influencing the heavy metal content. The spatial distribution prediction trend of heavy metal elements by different prediction methods is basically consistent, with the high-value areas of Cd and Pb respectively distributed in the northwest and northeast of the basin center. However, the MSA-GNN-HMP model demonstrates superior detail representation in spatial prediction. MSA-GNN-HMP model has excellent spatial information representation capabilities and can more accurately predict heavy metal content and spatial distribution, providing a new theoretical basis for monitoring, assessing, and managing soil pollution.