As important ecosystem engineers in soils, earthworms strongly influence carbon cycling through their burrowing and feeding activities. Earthworms do not perform these roles in isolation, because their intestines create a special habitat favorable for complex bacterial communities. However, how the ecological functioning of these earthworm-microbe interactions regulates carbon cycling remains largely unknown. To fill this knowledge gap, we investigated the bacterial community structure and carbon metabolic activities in the intestinal contents of earthworms and compared them to those of the adjacent soils in a long-term fertilization experiment. We discovered that earthworms harbored distinct bacterial communities compared to the surrounding soil under different fertilization conditions. The bacterial diversity was significantly larger in the adjacent soils than that in the earthworm gut. Three statistically identified keystone taxa in the bacterial networks, namely, Solirubrobacterales, Ktedonobacteraceae, and Jatrophihabitans, were shared across the earthworm gut and adjacent soil. Environmental factors (pH and organic matter) and keystone taxa were important determinants of the bacterial community composition in the earthworm gut. Both PICRUSt2 (Phylogenetic Investigation of Communities by Reconstruction of Unobserved States) and FAPROTAX (Functional Annotation of Prokaryotic Taxa) predicted that carbon metabolism was significantly higher in adjacent soil than in the earthworm gut, which was consistent with the average well color development obtained by the Biolog assay. Structural equation modeling combined with correlation analysis suggested that pH, organic matter, and potential keystone taxa exhibited significant relationships with carbon metabolism. This study deepens our understanding of the mechanisms underlying keystone taxa regulating carbon cycling in the earthworm gut.