Inside your intestines there are billions of tiny little bacteria that digest your food for you. They break the food down into component nutrients that your body can absorb, and they keep a little for themselves. Well, they fart. I mean, in the chemical breakdown of your food there is always a little gas given off - co2, methane, etc. Well... all those microscopic bactria farts add up. And when enough gas pressure has built up inside you, you fart. If you didn't you'll swell up and explode.