Currently, heavy metal pollution has emerged as a global issue. Compared with green plants, edible fungi, significant crops cultivated worldwide, present a greater capacity to accumulate heavy metals (HMs). However, the enrichment characteristics and functions of heavy metal transporters (HMATs) in the accumulation of HMs in edible fungi are still unclear. Cadmium (Cd) and mercury (Hg) are the primary HMs enriched in edible fungi. This study focused on Pleurotus ostreatus, the second largest edible mushroom worldwide, to examine the enrichment process. In this study, a series of different concentrations of CdCl2 and HgCl2 (0, 0.01, 0.05, 0.5, 2, 5, 10, and 20 mg/L) were used to mimic HMs pollution. HMs in the experimental concentration range did not affect the mycelial growth rate or fruiting body yield of P. ostreatus. However, in the 20 mg/L treatment group, the HMs were mainly concentrated in the cap, with about 4.4 mg/kg Cd and 2.7 mg/kg Hg, and were predominantly present in the most toxic ion exchange state. Thirteen HMATs were identified in the genome database of P. ostreatus. Using RT-qPCR, seven HMATs (24093, 1066001, 1106787, 1066344, 1079972, 1095088, and 1104877) whose expression levels were more than twice that of the control under most concentrations of HMs were selected for further investigation of their transport functions and their involvement in signal regulation. Among them, gene 24093 was involved in the absorption of Cd and Hg. These transporters are regulated by ROS, Ca2+, and NO signals under HM stress. This study provides target genes for reducing the risk of HM accumulation through molecular means, and serves as a reference for HM remediation using edible fungi.