Few studies have explored the mechanisms linking adverse childhood experiences (ACEs) to depression in medical students. This study aimed to investigate the relationship between ACEs and depression through the serial mediation effect of family functioning and insomnia. A cross-sectional survey was conducted with 368 medical students from university in Chengdu in 2021. The participants were asked to complete four self-report questionnaires, including ACEs scale, the family APGAR index, the ISI and PHQ-9. Singe and serial mediation analyses were conducted using structural equation modeling by Mplus 8.3. ACEs had a significant direct effect on depression (β = 0.438, p < 0.001) and through three significantly indirect pathways: (1) through family functioning (β = 0.026, 95% CI: 0.007-0.060), accounting for 5.9% of the total effect; (2) through insomnia (β = 0.103, 95% CI: 0.011-0.187), accounting for 23.5% of the total effect; and (3) through the serial mediators involving in family functioning and insomnia (β = 0.038, 95% CI: 0.015-0.078), accounting for 8.7% of the total effect. The total indirect effect was 38.1%. This cross-sectional study prevented us from establishing causality. This study highlights the role of family functioning and insomnia as serial mediators of the relationship between ACEs and depression. Findings help to elucidate the mechanism that underlines the pathway between ACEs and depression in medical students. These findings may indicate developing measures to strengthen family functioning and improve insomnia aiming to reduce depression in medical students with ACEs.