Intestinal gas is known as flatus. Thousands of different species of bacteria inhabit the human gut. Archaea, single-celled organisms that used to be classified with bacteria but are now in their own domain, also contribute to the production of intestinal gas.
Some of the residents of the gut help to break down organic compounds by fermentation. This is because some undigested organic matter from food makes it to the large intestine. When these substances are metabolized, it results in the formation of fatty acids, carbon dioxide and hydrogen gas. This occurs mainly in the colon.
Many bacteria can cause hydrogen to combine with sulfate found in the intestine to form hydrogen sulfide, a gas associated with a bad odor. Others can reduce carbon dioxide to form acetate. Archaea known as methanogens can convert hydrogen gas to methane which is essentially natural gas.
Therefore, when someone passes gas, breaks wind, or farts, it is due to the bi-products produced by the symbiotic organisms which reside in the human gut metabolizing undigested foods and releasing gas.