"how did it ever get so popular"
Because people like it, and eat it...
History is littered with recipes that various food companies thought were a good idea at the time, but which either never caught on, or which didn't survive changing sensibilities regarding diet or the like.
Here's a good example...
In the days before air conditioning became widespread there were LOTS of recipes that were intended to be served cold in summer. Jello even came out with a recipe book called Cooking with Cold to capitalize on the spread of electric refrigerators -- that's where a lot of the various molded jello salads (fruit, vegetables, and even meat) came from.
As A/C became widespread, a lot of the old summer recipes that were once very popular began to fade away.
I grew up in a house without A/C, and summer could be tough. My Mom frequently made jello salads, pasta salads, etc., for summer. They were filling, they were light, and they were good.
Of all of those old recipes, though, the only ones that I still make myself (even though I have central air) are either ripe tomatoes or ripe cucumbers stuffed with tuna or chicken salad and served chilled.
Recipes like the green bean casserole were really no different in that they originated to meet the social needs of the time AND were designed to flog a company's products. In the post-war era, though, it was all about convenience food because more women were working jobs AND taking care of the kids at home.
There are tons of "classic" casserole recipes from the time that were nothing more than a bunch of canned or frozen ingredients combined and heated (or chilled). Kids then grew up on them, and carried those into their adult lives. Some, like the green bean casserole, had staying power. Other's are nothing more than culinary footnotes.