Pigs are dirty animals. In order to ensure their survival and comfort, pigs often carry out certain actions that seem dirty to humans, such as rolling in mud frequently.
In hot conditions, pigs have a difficult time regulating their internal temperatures because of an inadequate ability to sweat. In order to keep cool, pigs lay or roll in mud. Pigs are also sensitive to the sun and can often get serious sunburns. Covering their bodies in mud helps to protect them from sun damage. Pigs also use mud to protect their skin from flies and parasites. If their pens are kept clean and they are provided adequate shelter, pigs do not get as dirty.