Heavy metal pollution presents significant challenges to global sustainable development. The treatment of such pollution predominantly relies on government policies, often neglecting farmers' crucial role in the remediation process. Therefore, this study investigates the driving mechanisms behind farmers' willingness to control heavy metal pollution in farmland. By analyzing survey data from 718 rice farmers in China, this study employs the Probit model to quantitatively assess the impact of farmers' perceptions of heavy metal hazards on their inclination to control pollution in farmland. Additionally, it examines the heterogeneity of these impacts between cultivated rice for domestic consumption and rice for export. The findings reveal the following: (1) Approximately 70% of farmers recognize the harmful effects of heavy metals, but only 66.2% of them express willingness to engage in pollution control measures. (2) More awareness regarding heavy metal hazards corresponds to a stronger intention to control pollution. (3) In addition to hazard perception, households with village cadres demonstrate a significantly positive influence on pollution control intention. (4) There are notable disparities in farmers' attitudes towards retained rice (for domestic consumption) and exported rice, with a greater willingness to implement pollution control measures for retained rice. As such, this study provides valuable insights for informing policy development to address the challenges associated with heavy metal pollution control's complex and limited effects. The findings contribute to a better understanding of the Chinese context as a typical developing country, offering analytical cases that promote global sustainable development while leveraging Chinese wisdom.