Just like any other similar situation: When two substances at
different temperatures are brought into contact, heat flows from
the warmer one to the cooler one. It continues until the warmer
object cools down, and the cooler object warms up, both to the
same temperature. Not so mysterious.