To explore the association between maternal gestational diabetes mellitus (GDM) exposure and the development of autism spectrum disorder (ASD) in offspring. A case-control study was conducted, recruiting 221 children with ASD and 400 healthy children as controls. Questionnaires and interviews were used to collect information on general characteristics of the children, socio-economic characteristics of the family, maternal pregnancy history, and maternal disease exposure during pregnancy. Multivariate logistic regression analysis was used to investigate the association between maternal GDM exposure and the development of ASD in offspring. The potential interaction between offspring gender and maternal GDM exposure on the development of ASD in offspring was explored. The proportion of maternal GDM was significantly higher in the ASD group compared to the control group (16.3% vs 9.4%, P=0.014). After adjusting for variables such as gender, gestational age, mode of delivery, parity, and maternal education level, maternal GDM exposure was a risk factor for ASD in offspring (OR=2.18, 95%CI: 1.04-4.54, P=0.038). On the basis of adjusting the above variables, after further adjusting the variables including prenatal intake of multivitamins, folic acid intake in the first three months of pregnancy, and assisted reproduction the result trend did not change, but no statistical significance was observed (OR=1.94, 95%CI: 0.74-5.11, P=0.183). There was an interaction between maternal GDM exposure and offspring gender on the development of ASD in offspring (P<0.001). Gender stratified analysis showed that only in male offspring of mothers with GDM, the risk of ASD was significantly increased (OR=3.67, 95%CI: 1.16-11.65, P=0.027). Maternal GDM exposure might increase the risk of ASD in offspring. There is an interaction between GDM exposure and offspring gender in the development of ASD in offspring.