Gassy poop can happen when your digestive system is backed up from constipation or you have diarrhea caused by food intolerance or infection. It can also simply occur when you eat certain foods.
The worst foods to eat with diarrhea are dairy products, sugar alcohols, and acidic, fried, or spicy foods. The worst beverages to drink when you have diarrhea are alcohol, coffee, and energy drinks.