The polymer matrix itself is composed of long chains of hydrocarbon molecules. These chains are not conducive to the efficient transfer of thermal energy. When heat is applied to Styrofoam, the molecular structure and the trapped air act as barriers that impede the movement of heat. The heat energy encounters resistance as it tries to pass through the material, making Styrofoam a good insulator.
In summary, the combination of the high percentage of trapped air and the nature of the polymer matrix in Styrofoam hinders the transfer of heat, making it an effective insulating material and a poor conductor of heat. This property is why Styrofoam is commonly used for insulation in various applications, such as packaging materials and building insulation.