Depression, a prevalent psychiatric disorder, presents a serious health risk to humans. Increasing evidence suggested that the gut microbiota and the 5-hydroxytryptamine (5-HT) pathway both contribute significantly to depression. This research aimed to investigate how Corydalis yanhusuo polysaccharides (CYP) could potentially alleviate depression induced by chronic unpredictable mild stress in mice, as well as its underlying mechanism. The sucrose preference test, tail suspension test, and forced swimming test were employed to evaluate the behavior of mice. Enzyme-linked immunosorbent assay and PCR techniques were utilized to measure depression-related factors (dopamine [DA], 5-HT, norepinephrine [NE], brain-derived neurotrophic factor [BDNF], tryptophan hydroxylase 2 [TPH-2], 5-hydroxytryptophan [5-HTP], and tryptophan hydroxylase [TPH-1] levels). Hematoxylin and eosin staining and Nissl staining were conducted to observe histopathological changes in the hippocampus, the differences in the diversity of gut flora between groups were analyzed using 16S rRNA sequencing, and gas chromatography-mass spectrometry metabolomics was utilized to evaluate short-chain fatty acid (SCFA) concentrations. The findings indicated that CYP treatment increased the sucrose preference index, decreased the immobility time, and improved neuropathological injury. In depressed mice, CYP improved the dysregulation of the gut microbiota, and increased the SCFA levels. In addition, CYP enhanced the DA, 5-HT, NE, BDNF, and TPH-2 levels in the brain and the expression of 5-HTP and TPH-1 in the colon, while SCFAs were positively correlated with these levels. In summary, our study suggested that CYP may mitigate depression by ameliorating gut microbiota dysregulation, promoting the generation of SCFAs, and activation of 5-HT signaling expression.