There are all sorts of receptors in all sorts of nerves, but the
nerves in the tongue have a lot of one particular receptor that responds
to heat. It's called the TRPV1 receptor, if anyone wants to know.

So when you eat or drink something hot, these receptors get that
heat signal, and that tells the nerve to let the brain know what's going
on.

When the brain gets the message "It's hot in here," it
turns on the mechanism we have to cool ourselves off: sweating.