Surprisingly, it's not just the food.
The ideal gas law is a property you might remember if you took high school chemistry; it defines the relationships between a gas’ temperature, volume, and pressure, and is described by the following equation:
The significance of a few of those letters is easy to guess; p stands for pressure, V is volume, and T is temperature. Less obvious is n, which depends on the number of molecules in question, and R, the ideal gas constant. R is the factor that makes all these numbers fit together nicely, and its value will change depending on the units you’re using.
If you’ve taken a sealed bag of chips on a plane, you might have noticed it behaving strangely; while the bag only seems to be half-full of air on the ground, it can swell until it looks like it’s ready to burst once the plane has taken off. This is because, while the plane's air handling systems pressurize the cabin enough to make the extreme altitude survivable, the cabin pressure still ends up lower than the air pressure we’re used to on the ground. Since the chip bag is sealed and the whole system stays at a roughly constant temperature, n and T are fixed, and the right-hand side of the ideal gas equation can’t change. Consequently, when the air pressure p decreases, its volume V will increase proportionally, in order to keep the equation balanced. In short, the same amount of air takes up more space, whether that air is inside a bag of chips or in your intestines, because there's less air pushing in on it from the outside.
However, the trouble doesn’t end there. Not only do airplane farts take up more space per molecule than their ground-based counterparts, but they build up faster, thanks to Henry’s law. Named for English chemist William Henry (who certainly never imagined his name being invoked in relation to this kind of problem), Henry’s law dictates that the solubility of a gas in liquid depends on the partial pressures of the gas above the solution. While the “partial” bit of that statement has to do with the ratios of various gases in the mixture, the upshot is that, when the cabin pressure drops, the ginger ale making its way through your bowels starts to give up its carbonation faster than before, along with dissolved methane and other gases produced by intestinal bacteria. It's similar to the way carbon dioxide begins bubbling out of soda when you open a bottle for the first time.
While unfortunate, this phenomenon is nothing compared to decompression sickness, known colloquially as “the bends”. When a deep-sea diver resurfaces too fast, that same “bubbling out” happens to the gases dissolved in your blood, with potentially disastrous consequences; gas bubbles in the bloodstream can cause heart attacks, strokes, and paralysis depending on where they end up. (By comparison, a bit of gassiness doesn’t seem so bad!)
And so, like a bloated and smelly Icarus, we must grudgingly bear the consequences of flying where our bodies were never meant to go--but if the embarrassment is too much for you, scientists have suggested a solution: charcoal-infused underwear.