AimThe objective of this study is to explore the relationship between sex and jaw function and to test whether anxiety mediates the causal relationship between sex and jaw function in temporomandibular disorders (TMDs) patients.MethodsA total of 488 participants with TMD were included in the analysis. Demographic data were collected. Generalized anxiety symptoms and anxiety severity were initially assessed using the GAD-7 questionnaire. And jaw function limitation was measured using the JFLS-8 scale. A directed acyclic graph (DAG) was used in this study to evaluate the hypotheses. Mediation analysis was conducted to explore causality and to calculate the total effect, natural direct effect (NDE) and natural indirect effect (NIE).ResultsIn TMD patients, there was a significant association between female and jaw function (r = 0.17, p < 0.001), female and anxiety (r = 0.15, p = 0.002), anxiety and jaw function (r = 0.35, p < 0.001). In addition, sex can directly lead to differences in impaired jaw function (NDE: 3.719, 95% CI: 1.619–5.828, p < 0.001), and can also be causally related to jaw function through anxiety (NIE: 1.146, 95% CI: 0.267–2.024, p = 0.011). And the total effect was 4.865 (95% CI, 2.709–7.029, p < 0.001).ConclusionA causal mechanism was found that anxiety acts as a mediator of sex effects on jaw function. Therefore, psychological factors need to be taken into account in the treatment of female TMD patients. Further clinical trials are needed to explore whether psychotherapy is more beneficial to improve jaw function in female TMD patients.