Infertility, an escalating public health issue, exacerbates psychological distress, especially anxiety, among affected individuals. This study explores the intricate relationships between family function, self-efficacy, and social support in moderating anxiety levels in male infertility patients. Understanding these dynamics offers valuable insights for crafting effective psychological interventions. This study involved 202 male infertility patients through convenience sampling, employing the Self-Efficacy Scale, Social Support Rating Scale, Family Function Scale, and Anxiety Self-Rating Scale for assessment. Structural equation modeling (SEM) with Bootstrap analysis was utilized to explore the relationships among these variables. Analysis of 202 male infertility patients revealed a notable prevalence of anxiety (67.8%), with family function directly and indirectly influencing anxiety levels through self-efficacy and social support. SEM highlighted the mediating roles of self-efficacy and social support between family function and anxiety, demonstrating significant direct (family function on anxiety) and indirect effects (family function to anxiety via social support and self-efficacy). Notably, a chain mediation effect, where family function impacts anxiety through the sequential influence of social support and self-efficacy, accounted for a significant portion of the total effect on anxiety. These findings emphasize the critical role of enhancing family function, self-efficacy, and social support to reduce anxiety among this population. This study underscores the significant impact of family function on the psychological well-being of male infertility patients, with self-efficacy and social support serving as pivotal mediators. Improving these factors could effectively mitigate anxiety, suggesting that interventions targeting family dynamics, self-efficacy enhancement, and social support networks are essential for addressing the psychological distress associated with infertility. Future research should consider these dynamics to develop more comprehensive treatment and intervention strategies aimed at this vulnerable group.