How exercise changes the bacteria in your gut
There is no doubt that people who exercise, especially athletes, are in many ways healthier than individuals with sedentary lifestyles. However, there are some aspects of exercise training that may create physical imbalances, particularly in the gut flora.
The Athlete's Diet
To start, athletes often practice specific dietary practices that can alter the microbiome, such as the consumption of high protein diets. The macronutrient composition of these regimens, or the amount of carbohydrates, fats and proteins in the diet, has a significant impact on the balance of the flora in large intestine.
In fact, consuming a mostly animal or mostly plant diet can dramatically alter the composition and function of the gut microbiome in as few as 24 hours.
Specifically, an animal-based diet (high-fat, low-fiber) increases the amount of bile-tolerant microorganisms (that help digest fat); decreases the number of Firmicutes; and increases the number of Bilopha wadsworthia, a sulphite reducing bacteria.
By contrast, a plant-based diet (high-fiber, low-fat) increases the number of Bacteroidetes, Faecalibacterium prausnitzii, Prevotella and Xynalebacter; and reduces the number of Firmicutes in the gut. [1,2]
While some of these bacteria are beneficial to one's overall health, others might be harmful. For example we know that when bacteria from high-fat diets are in abundance, they increase intestinal inflammation, which can ultimately lead to an increase in systemic inflammation. If fat consumption is not moderated over time, individuals are at risk of developing chronic systemic inflammation, which has been linked with many lifestyle diseases including diabetes and heart disease.
Thus, it is apparent that diet can greatly influence the composition of the gut microbiome, which in turn, can have a significant impact on the host's health. 
Independent of a person's diet, exercise alone has the power to increase microbial diversity, and moderate exercise especially has well-known benefits for gut health.
In turn, exercise capacity may be influenced by the presence of a diverse microbiota. For example, during prolonged exercise, the short chain fatty acids produced by the flora in the lower GI tract can provide fuel for the host. 
Training And Exertion
While moderate exercise can benefit the intestinal microbiome, extreme exercise and intense training may create immune stress that can contribute to dysbiosis. This is evident by the marked increase in stress hormones like cortisol that occur during high intensity or prolonged activities.
Athletes who train at this level typically do so frequently, creating a constant stress and therefore potentially an imbalanced microbiome. This can lead to more than just GI issues. It can influence cognitive function which is directly related to motivation, focus and mood.
Therefore, improving and maintaining microbial balance can keep an athlete focused and on the top of their game. 
The gut microbiome and its influence on host behavior, intestinal barrier and immune function are believed to be a critical aspect of the gut-brain axis. 
This has important implications for athletes, as fatigue, mood disturbances, under-performance and gastrointestinal distress associated with over-exertion are common among athletes during training and competition.
This is not to dismiss that less-strenuous exercise also induces a level of “stress" to homeostatic mechanisms that ultimately result in training adaptations.
Associated with these can be a stress-related release of catabolic hormones, inflammatory cytokines and microbial molecules all of which can influence microbial balance.
In fact, it has been suggested that gut microbiota might have a key role in controlling the oxidative stress and inflammatory responses, as well as improving metabolism and energy expenditure during intense exercise. 
Not surprisingly, GI issues are among the most common complaints of athletes, both acutely during an event and chronically over time. According to one review,
30-50% of athletes suffer GI symptoms in endurance events, but that percentage is even higher in extreme exercise conditions: as high as 93% in competition. 
Frequent trips to the porta-potty has certainly interfered with many personal bests.
Therefore, correcting any dysbiosis and maintaining microbial diversity can help to give athletes the cutting edge. This is why products like IgY Max, which target specific strains of gut flora, can help reduce the attachment of non-commensal bacteria to support a “high performing” GI tract.
Trust Your Gut
The exact connection between exercise-induced stress, the associated adaptations, over-exertion, the gut microbiota and performance have not been clearly identified.
However, what is clear is that it may be possible to design diet and supplemental strategies to optimize microbial balance and maximize performance through the gut-brain axis. For example, a change in diet can significantly influence the composition of the gut microbiota composition in just 24 hours.
The use of probiotics to modify the microbiota has also been identified as an important therapeutic tool to improve athletes' overall general health, performance, and energy availability while controlling inflammation levels. 
Therefore, any discussion of the cognitive aspect of sports nutrition must include a review of the literature related to exercise-induced stress and its influence on the microbiota via the gut brain axis, as well as its impact on an athlete’s health and performance.
David LA, Maurice CF, Carmody RN, et al. Diet rapidly and reproducibly alters the human gut microbiome. Nature. 2014;505:559–63. doi: 10.1038/nature12820.
Aguirre M, Eck A, Koenen ME, et al. Diet drives quick changes in the metabolic activity and composition of human gut microbiota in a validated in vitro gut model. Res Microbiol. 2016;167:114–25. doi: 10.1016/j.resmic.2015.09.006.
Fasano A. Leaky gut and autoimmune disease. Clin Rev Allergy Immunol. 2012 Feb; 42(1):71-8
Campbell, Sara C.; Wisniewski, Paul J. II. Exercise is a Novel Promoter of Intestinal Health and Microbial Diversity. Exercise & Sport Sciences Reviews. 2017;45(1):41-47.
de Oliveira EP, Burini RC, Jeukendrup A. Gastrointestinal complaints during exercise: prevalence, etiology, and nutritional recommendations. Sports Med. 2014;44:S79–S85. doi: 10.1007/s40279-014-0153-
El-Ansary A, Shaker GH, Rizk MZ (2013) Role of Gut-Brain Axis in the Aetiology of Neurodevelopmental Disorders with Reference to Autism. J Clin Toxicol S6:005. doi: 10.4172/2161-0495.S6-005