I think it is all about the intermolecular forces. Heating causes expansion because the intermolecular distances between the atoms increase. This is because the atom vibrates in larger amplitudes and the bonding becomes weaker.
So there is no stain or stress. That is why when the expansion or contraction is resisted by any constrains, internal stresses show up.