Asari Radix et Rhizoma is commonly used in classic prescriptions of herbal medicine in several Asian countries for resuscitation, pain relief, and sore treatment, and Asarum heterotropoides (A. heterotropoides) is an important source material of Asari Radix et Rhizoma. However, the plants of the Asari Radix et Rhizoma and some plants in Asarum spp. contain aristolochic acid I (AAI), which is considered as a carcinogen. The objective of the current study is to detoxify Asarum spp. through microbial degradation of AAI in order to ensure drug safety. Based on the observation of the close correlation between endophytic fungi of A. heterotropoides and AAI, we identified an AAI-degrading fungus and screened for candidate genes involved in AAI degradation. Full-length O-demethylase genes (ODMs) were cloned including A.h-ODM-5, Fs-ODM-4, and Fs-ODM-1, and their ability to degrade AAI was tested in vitro. The results showed that the AAI-degrading fungus was identified as Neocosmospora solani (A.h-Fs-1, endophytic fungi of A. heterotropoides), and verified the capability of specific O-demethylation to modify the structure of AAI. We further identified the functional ODMs in A.h-Fs-1 capable of degrading AAI and uncovered the AAI degradation mechanism of A.h-Fs-1. The microbial degradation of AAI demonstrated in the present study offers a new method to detoxify plant materials used for herbal medicine, and would enhance the regulation of toxic ingredients content in herbal medicine source materials.