Unlike thermos, which has become a generic word, Styrofoam is still struggling to retain its identity as a trademark, but nobody seems to be paying attention; people call all polystyrene foam products “styrofoam” anyway.
The material is a good insulator because the plastic foam contains billions of trapped gas bubbles. Gases hinder heat conduction because their molecules are so far apart that they’re very difficult for other molecules to collide with, either to give or to take away energy. The polystyrene plastic in between the bubbles is a good insulator also, because its molecules are so big that they can’t move around much.
The thin Styro, I mean, polystyrene foam, boxes that restaurants pack your doggie-bag food in are supposed to keep the food hot on your way home. Instead of staying really hot, though, the food is probably being kept at just the right temperature for bacteria to flourish.
Then, when you get home, you put the whole box in the refrigerator for the next day’s lunch, but the foam insulation may keep it at maximum spoilage temperature for another hour or so. Better to transfer the food into an uninsulated container before putting it in the refrigerator.