Detergent gets hot when dissolved in water due to the enthalpy change of solution, a phenomenon where certain substances release heat during the dissolving process. When they are added to water, they form well-defined chemical bonds with water molecules, which can lead to an exothermic reaction, releasing heat.