The interaction between our gut and our brain has been studied for decades, and research has demonstrated a strong connection between the gut and our immune system, enteric nervous system, and gut-based endocrine system.  More recently, the scientific community has found intriguing evidence pointing to the role of gut bacteria in shaping brain neurochemistry and emotional behavior.  In other words, our gut may play a large role in regulating how we think and feel.

The exact way by in which this bacterial ecosystem (also called the microbiome) alters the brain is not clear, and most researchers agree that there are several mechanisms involved.  It has been discovered that gut bacteria produce neurotransmitters such as serotonin, dopamine, and GABA, which play an important role in our mood (many antidepressants work by impacting levels of these same compounds).  Also, scientists have found that certain gut bacteria can influence the amount of these neurotransmitters that circulates in the blood and brain (by affecting how people metabolize them).  Our gut bacteria may also generate other neuroactive chemicals such as butyrate, which has been linked to reduced anxiety and depression.  Studies have shown that certain microbes can activate the Vagus nerve (the main line of communication between the gut and the brain).

Lastly, the microbiome is intertwined with our immune system, which itself can impact how we feel and behave.  Importantly, scientists have begun to find evidence that gut bacteria could play a crucial role in autism, anxiety, depression, and other disorders.

As we learn more and more about the gut-brain connection, the information gained could be used to help relieve certain symptoms associated with these disorders.

Some scientists even believe that these bacteria could eventually be used the way we now use certain medications (like Prozac or Valium).  This would mean a more precise approach to treatment with fewer side effects.

References:

https://www.ncbi.nlm.nih.gov/pmc/articles/PMC4228144/

https://www.psychologytoday.com/blog/the-athletes-way/201601/exercise-alters-gut-microbes-promote-brain-health

http://www.theatlantic.com/health/archive/2015/06/gut-bacteria-on-the-brain/395918/?utm_source=atlfb