If you're an American, you almost certainly sang the rhyming song about beans as a kid. While I'm not sure how true it is that beans are good for your heart, and cholesterol levels don't even seem to be lowered by beans, the second part of the verse is certainly true, as they can make you... lets say, flatulent.
The reason beans can make you gaseous is because they contain at least two starches: raffinose and stachyose. These starches pass through the human digestive tract undigested, only to be feasted upon by the microorganisms in your colon. The multiplying microorganisms produce carbon dioxide which you experience as... gas!
But here's the sciency part that a lot of people might appreciate. You can reduce the problems beans cause with a two step method:
Step One: Soak the beans overnight and discard the water. This will reduce one of the causes of flatulence, a starch called stachyose, by 90%.
Step Two: Add a couple of pinches of baking soda to the water when you cook the beans. The baking soda reduces the levels of raffinose, and leads to improved tolerability of beans. Improving the tolerability of beans is something everyone around you can appreciate.
Sources
http://europepmc.org/abstract/med/1964898
https://captious.wordpress.com/2006/05/01/common-bean-myths/
https://nutritionfacts.org/questions/does-adding-baking-soda-to-soaking-beans-reduce-raffinose/
Photo was taken by me