It is normal to have some flatulence. The average person passes gas through the rectum 8 to 20 times a day. Flatulence is usually a problem only when the gas smells foul, happens frequently, or occurs at inconvenient times. Part of the flatus in the intestine is air that you have swallowed. You may swallow large amounts of air with your food, especially if you eat or drink quickly.
Some people have a nervous habit of swallowing air all day, especially in times of stress.
If you are in an upright position, swallowed air can pass back up from your stomach and be released through your mouth in a belch. However, each time you belch, you swallow more air, so the belching is likely to continue. When you lie down, the air may instead pass on through the intestines and rectum and out the anus. The other cause of gas in the intestines is the digestive process itself. Bacteria in the intestines produce gas as they break down food residues.