This is one of those idiomatic things. To have "a" pork in English would be verging on the pornographic (it's slang for ❤❤❤❤❤❤❤❤❤❤❤), but to have pork (in the sense of eating it) would be grammatically correct.
I think in a speaking context, I might go with "Io ho un porco" rather than maiale, so as to distinguish between the animal and its meat. Any Italian speakers want to weigh in on this?
But we have also the phrase "un succo" in this course, and there's no explanation why "succo" is countable and "maiale" uncountable