The effective production of NO2−-N through endogenous partial denitrification (EPD) provides a promising perspective for the broader adoption and application of anaerobic ammonia oxidation. However, the accumulation of polycyclic aromatic hydrocarbons (PAHs) in the environment may worsen the operational challenges of the EPD system. This study evaluated the resilience of the EPD system to the toxic impacts of phenanthrene (PHE) and anthracene (ANT) through macrogenomic analysis. A control group was maintained under identical conditions for comparison. The results revealed that PHE and ANT had a relatively minimal impact on NO3−-N transformation and organic matter removal but significantly affected PO43−-P removal and NO2−-N accumulation in the EPD process. The PHE system achieved a higher NO2−-N accumulation, with a maximum NO3−-N to NO2−-N conversion ratio of 90.08%. In contrast, the ANT system exhibited higher efficiency in the PO43−-P removal, achieving a peak removal rate of 74.94%. Macrogenomic analysis revealed that PAHs significantly enriched both denitrifying glycogen-accumulating organisms (including Candidatus_Competibacter) and denitrifying polyphosphate-accumulating organisms (such as Thauera, Candidatus_Contendobacter, and Candidatus_Accumulibacter). This enrichment stabilized these organisms, facilitating NO2−-N accumulation and PO43−-P removal. Metabolic pathway analysis indicated that PHE promoted the enrichment of NO3−-N reductase and inhibited NO2−-N reductase activity. However, ANT stimulated oxidative phosphorylation and the phosphate cycle. Moreover, PAH metabolites enhanced the expression of key genes encoding succinate dehydrogenase and isocitrate dehydrogenase in the tricarboxylic acid cycle within the EPD process, leading to increase the synthesis and utilization of acetyl coenzyme-A. Notably, significant differences were observed between the effects of PHE and ANT on these metabolic processes. This study provides new methods for treating PAH-containing wastewater through the combination of EPD and anaerobic ammonia oxidation.