Transmissible gastroenteritis virus (TGEV) infection induces diarrhea in piglets by targeting the small intestine, especially the jejunum and ileum. However, dynamic changes in the gut microbiota and metabolome during TGEV infection remain unclear. This study investigated these alterations and their association with intestinal damage in weaned pigs during early TGEV infection. Thirty 4-week-old pigs were allocated randomly into TGEV-inoculated and mock groups. On days 3, 5, and 7 postinoculation, intestinal tissue and fecal samples were collected. Full-length 16 S rRNA sequencing and ultrahigh-performance liquid chromatography-tandem mass spectrometry (UHPLC‒MS/MS) were employed to analyze microbiota composition and nontargeted metabolites. TGEV infection resulted in reduced villous height-to-crypt depth (VH:CD) ratios (P < 0.01) and significantly altered microbial diversity (P = 0.0091 in jejunum) and composition (P = 0.001). Notably, infected pigs showed increased abundances of Lactobacillus and Limosilactobacillus species. The VH:CD ratio correlated with the overall taxonomic composition in both the jejunum and ileum (r = 0.4, P < 0.001) and was positively associated with microbial functions such as aerobic chemoheterotrophy and chitinolysis in the jejunum. Fecal metabolomics revealed 1815 and 892 differentially expressed metabolites in the jejunum and ileum, respectively, including amino acids, fatty acids, and intermediates of energy metabolism. Integrated analysis revealed that Lactobacillus amylovorus DSM20531 was positively correlated with linoleic acid, L-tyrosine, and citric acid, whereas Lactococcus lactis showed a negative correlation with isocitric acid and glutamine. This study enhances our understanding of the pathogenesis of TGEV and provides potential microbial and metabolic biomarkers for future diagnostic and preventive strategies.