Flatulence is caused by swallowing air and eating foods that are difficult to digest. Some food like beans contain raffinose, and it is broken down by bacteria in the intestines and causes flatulence.