Pigs run into things all of the time. This can be a ball of infection (like an access). The first time we saw this we took the pig to the vet, he punctured it and out came a lot of cottage cheese looking puss that smelled to high heaven.
After years of seeing injuries like this on and off we now take care of it ourselves on farm.
My suggestion is see the vet, find out what it is and how to treat it. Determine if it is something you can and want to take care of in the future on farm if it presents itself again.