Fermentation generally occurs in your gut (large intestine) when food that you've ingested isn't fully digested. The undigested food passes into the large intestine where your gut bacteria will break it down. Gases like hydrogen are produced as a by product of this process. For some people, who have methanogens present in their gut, methane can also be produced. The hydrogen present in your gut is actually converted into methane.
Experiencing high fermentation levels is not necessarily a bad thing or even problem. However, a high amount of fermentation in people suffering with digestive issues can cause uncomfortable and distressing symptoms (e.g. pain, bloating, diarrhoea, constipation) so in those cases it can be a good idea to manage the level of fermentation.
Scientists have known for thousands of years about the benefits of fermentation. Even back in the 1800s, the French pediatrician Henry Tissier gave fermentable bacteria to infants suffering from diarrhoea. Today, we have learned (and are still learning!) a great deal about the benefits of colonic bacteria.