When a pig wags it's tail back and forth it means that the pig is content and happy.
I've been around pigs that whenever you came near them to pet them they would wag their tails because they were very happy to see you.
Pigs are some of the greatest farm animals and pretty clean animals as well even though they love to roll around in mud.
Pigs are also very tasty animals as well when you butcher them and eat the meat from them especially the ham and bacon parts.