The average kinetic energy of the particles in the mug decreases. The average kinetic energy of the particles in the coffee increases. Thermal energy from the mug is transferred to the coffee. Thermal energy from the coffee is transferred to the mug.
Water is a molecular compound consisting of polar molecules that have a bent shape. The oxygen atom acquires a partial negative charge while the hydrogen atom acquires a partial positive charge.