Pigs wallow in muddy pools of water primarily to lower their body temperature. Pigs cannot sweat and they have a limited number of sweat glands which makes it difficult for them to regulate their body temperature. By wallowing in mud or water, pigs are able to cool themselves down as the water evaporates from their skin. Additionally, the mud acts as a form of sunscreen and protects their skin from the sun's harmful rays.