this occurs through conduction when two things get in contact with each other.
here's a definition from kid's britannica: "Conduction transfers heat within a body or between two bodies that are touching. It is a point-by-point process of heat transfer. Conduction occurs in solids, liquids, or gases that are at rest. Energy flows, but the substance through which the heat is being transferred does not itself flow."