At the molecular level, the heat comes from the agitation of the molecules and therefore their atoms. This increase in agitation causes the molecules to be less condensed between them and will separate after breaks in the intermlecular bonds. This distends the material, as we see when we heat a metal, or a transformation of the phase of the material, such as melting ice or boiling water.