Laying in the dirt or in most cases mud, will cool an animal by bringing its temperature down. Usually dirt is already cool, if a rain hadn't already wetted it. If a pig lays in the mud, they love to sprawl on their belly which actually helps them to cool down. Blood vessels closer to the skin on a pig's belly carry the cooled blood throughout the body and the pigs temp goes down. It's kind of like with a jackrabbits ears and how the blood vessels are close to the skin.