That's a really good question. I thought the answer would be obvious, but I can't find ANY information online about the legality of animals purchasing plane tickets. I'm sure stuff like that must come up - as, for example, all those cases where cats get left millions of dollars by batshit old lunatics; surely, "the cat", or at least someone connected with the cat's estate, would wind up buying plane tickets at some point? - but I dunno. I really don't know.
That said, YES. A pig CAN fly - if he is an emotional support animal, accompanying a human. Here is an article on that. I don't know if Helper Piggies are still allowed on civilian aircraft post-pandemic, but as of 2019 there were documented cases of pigs flying.
However, as for whether or not pigs can freely and consensually purchase their own airplane tickets - I can't say. I'd like to say that, in the absence of any laws against it, then yes they could. But I think this is a question that we'd need to send to a lawyer, maybe even a dedicated airplane lawyer.