In summary, our study shows that ferroptosis-related factors play a key role in immune infiltration in NPC and HNSCC, and ATG5, as a key immune invasion-related ferroptosis-related factor, has the potential to be a novel prognostic biomarker and a potential target in therapy for NPC and HNSCC. The gene discussed is ATG5; the disease is nasopharyngeal carcinoma.