Hot to cold of course!
Cold is merely the absence of heat.
The transfer is somewhat mechanical as the molecules of the hot substance are in rapid motion and when encountering molecules of a less heated substance (cold) they transfer their energy of motion to the colder substance, thus heating it up.