Diet and exercise underpin the risk of obesity-related metabolic disease. Diet alters the gut microbiota, which contributes to aspects of metabolic disease during obesity. Repeated exercise provides metabolic benefits during obesity. We assessed whether exercise could oppose changes in the taxonomic and predicted metagenomic characteristics of the gut microbiota during diet-induced obesity. We hypothesized that high-intensity interval training (HIIT) would counteract high-fat diet (HFD)-induced changes in the microbiota without altering obesity in mice. Compared with chow-fed mice, an obesity-causing HFD decreased the Bacteroidetes-to-Firmicutes ratio and decreased the genetic capacity in the fecal microbiota for metabolic pathways such as the tricarboxylic acid (TCA) cycle. After HFD-induced obesity was established, a subset of mice were HIIT for 6 wk, which increased host aerobic capacity but did not alter body or adipose tissue mass. The effects of exercise training on the microbiota were gut segment dependent and more extensive in the distal gut. HIIT increased the alpha diversity and Bacteroidetes/Firmicutes ratio of the distal gut and fecal microbiota during diet-induced obesity. Exercise training increased the predicted genetic capacity related to the TCA cycle among other aspects of metabolism. Strikingly, the same microbial metabolism indexes that were increased by exercise were all decreased in HFD-fed vs. chow diet-fed mice. Therefore, exercise training directly opposed some of the obesity-related changes in gut microbiota, including lower metagenomic indexes of metabolism. Some host and microbial pathways appeared similarly affected by exercise. These exercise- and diet-induced microbiota interactions can be captured in feces.