Hemophagocytic lymphohistiocytosis (HLH) is a life-threatening immune-mediated disease that affects patients with known genetic defects and is increasingly found among those with autoimmune diseases and persistent infections. Talaromyces marneffei (TM) is a human opportunistic fungus that commonly infects immunodeficient or immunosuppressed individuals. Few TM-associated secondary HLH cases resulting from autoimmune deficiency have been reported previously. The current case study describes a pediatric patient hospitalized with recurrent fever and lymphadenopathy. The child had abnormal blood cell classification, and microscopy revealed mature granulocytes that phagocytized fungal spores. It was speculated that the patient was infected with TM. The pathogen was detected earlier than the blood culture and confirmed by metagenomic next-generation sequencing. Whole-exome sequencing revealed that the patient had complex mutations associated with immunodeficiency. This included a mutation in exon 3 of the CD40LG gene, c.346G>A, which may be linked to hyper-IgM syndrome, a primary immunodeficiency disease with immunoglobulin conversion recombination defects that could explain the patient's increased susceptibility to serious opportunistic infections. In addition, a heterozygous frameshift variant, c.820dup (p.Asp274GlyfsTer61), was detected in exon 6 of CARD9, a key gene associated with fungal immune surveillance. After 4 days of fungal treatment, the abnormal blood cell clusters disappeared, but other infections occurred in succession for 6 months after rehabilitation. The patient was followed with the aim of providing subsequent immunotherapy. This study found that infection can trigger HLH in HIV-negative individuals, highlighting the importance of early definitive identification of the causative agent and investigation of potential immunodeficiency.