Microbial bioremediation is an advanced technique for removing herbicides and heavy metals from agricultural soil. In this study, the strain Stenotrophomonas pavanii MY01 was used for its ability to degrade glyphosate, a phosphorus-containing organic compound, producing PO43− as a byproduct. PO43− is known to form stable precipitates with heavy metals, indicating that strain MY01 could potentially remove heavy metals by degrading glyphosate. Therefore, the present experiment induced phosphate precipitation from Cu(II) (Hereinafter referred to as Cu2+) and Zn(II) (Hereinafter referred to as Zn2+) by degrading glyphosate with strain MY01. Meanwhile, the whole genome of strain MY01 was mined for its glyphosate degradation mechanism and its heavy metal removal mechanism. The results of the study showed that the strain degraded glyphosate best at 34°C, pH = 7.7, and an inoculum of 0.7%, reaching 72.98% within 3d. The highest removal of Cu2+ and Zn2+ in the test was 75.95 and 68.54%, respectively. A comparison of strain MY01’s genome with glyphosate degradation genes showed that protein sequences GE000474 and GE002603 had strong similarity to glyphosate oxidoreductase and C-P lyase. This suggests that these sequences may be key to the strain’s ability to degrade glyphosate. The GE001435 sequence appears to be related to the phosphate pathway, which could enable phosphate excretion into the environment, where it forms stable coordination complexes with heavy metals.