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.