Expansion and change of state
Heating makes particles move faster and spread further apart so materials expand; cooling slows them and materials contract.
A worked example
A 20 m steel span that gains about 0.24 mm for each degree warms by 30 °C on a hot day, so it grows 30 x 0.24 = 7.2 mm. That is why expansion gaps are left.
The mistake people actually make
The particles do not grow or gain mass when heated, they simply move more. Condensation is a gas cooling into a liquid; evaporation is the opposite direction.