Ever had a dental filling?
Bill Tindall, E.Tn.
Off to the side silver and mercury were mixed to make an amalgam- translation, the mercury dissolved the silver to make a mush that could be packed into the excavation. Don't know why it re-hardens, probably crystallization of some sort.
Ditto gallium and aluminum. Aluminum dissolves in the gallium just like the silver dissolved in the mercury. The oxide layer on aluminum prevents the gallium from getting to the bare aluminum so scratching may be necessary to get things started.
When things dissolve they can get hot or cold depending on what dissolves in what. I don't think there is much heat involved in this dissolution.