Simple illustration:

Take a yardstick place it on its edge with two pencils placed perpendicular to the yardstick, one pencil at the 1-inch point, and the other pencil at the 35-inch point. Place your pointer finger on the top edge of the yardstick at the 18-inch mark then push down. Which way will it move? It may go straight down a little, but it will move to one side or the other. That is exactly how a beam will fail under load. The wider / heavier the flanges are the more resistance to side movement / failure there is.