Objective. The gut microbiota, as the critical mediator of the gut-brain axis, can produce and transport neuroactive substances, thus playing a significant role in the pathogenesis of depression. Although regular physical exercise is an important nondrug antidepressant, its specific effector mechanism is still unclear. Methods. Rats were randomly divided into four different groups (n = 10 for each group) as follows: normal group (G1), depression group (G2), fluoxetine treatment group (G3), and regular exercise treatment group (G4). All rats underwent forced swimming tests, tail suspension tests, open field tests, and elevated plus-maze tests to detect behavioristics. Then, corticosterone levels were detected by ELISA. Additionally, taxonomic analysis of the gut microbiota in all rats was performed after they were exercised regularly for 60 days. Results. Compared with the G1 group, the rats in the G2 group showed significant depression-like behaviors, with increased serum corticosterone levels. The proportions of Bacteroides, Actinomycetes, Proteobacteria, Saccharomyces, and Cyanobacteria in rats of the G2 group were lower than those in the G1 group, while the proportions of Firmicutes, Tenicotte, Deferrobacteria, and Fusobacteria were increased. Furthermore, after regular exercise treatment, the gut microbiota of rats was effectively improved, almost returning to the level of the G1 group, and depressive behavior and corticosterone levels were also restored, which was almost the same as the effect of fluoxetine treatment. Conclusion. Regular physical exercise could alleviate depressive-like behaviors by modulating the species and function of the gut microbiota.