Gas or flatulence is primarily composed of carbon dioxide, oxygen, nitrogen, hydrogen, and sometimes methane. Flatus, gas passed through the anus, may also contain small amounts of gasses containing sulfur. Flatus that contains more sulfur gasses has more odor.
Food intolerance - Sensitivity to certain foods can cause you to have smelly gas. Some examples of sensitivity include Celiac disease (gluten intolerance) and lactose intolerance both of which affect your body's ability to break down components of food which can change the odor of your gas.
Foods known to contribute to flatulence odor:
- highly seasoned foods
- dairy products
(Source: National Institute of Diabetes and Digestive Kidney Diseases, National Institutes of Health)