There is a water soluble sugar that is in beans called oligosaccharides, and they are indigestible by human beings. They ferment during the digestion process, and hence, you have gas.

– Crescent Dragonwagon