What type of cat do you swing?
Solution 1:
Personally, I know two explanations. The first is provided by Phrase Finder:
Whether the 'cat' was a real moggy or the flail-like whip used to punish sailors in the British Navy isn't clear. Many reports claim that the cat in question is the 'cat o'nine tails'. As so often though, they don't supply evidence, just certainty. As a candidate for folk etymology goes the 'cat o' nine tails' story has it all - plausibility, a strong storyline and a nautical origin. That's enough to convince many people - the actual evidence shows the theory to be highly dubious. The phrase itself dates from at least the 17th century. Richard Kephale's Medela Pestilentiae, 1665:
"They had not space enough (according to the vulgar saying) to swing a Cat in."
The nature of that citation makes it clear that the phrase was already in use prior to it being committed to paper. The 'cat o' nine tails' isn't recorded until 1695 though, in William Congreve's Love for Love:
"If you should give such language at sea, you'd have a cat-o'-nine-tails laid cross your shoulders."
If those dates are in fact the earliest uses then the 'cat o' nine tails' theory is wrong.
However, as the post says, there is a possibility that this explanation is not true, if the cat-o'-nine-tails was invented after the phrase was invented.
The second explanation, which comes from my personal reading, is a veterinary practise.
I read, in James Herriot's accounts of his life as a veterinary in 1950s, that it seems that when trying to resuscitate a cat, or a dog, the vet would take the cat by the hind legs, and swing the cat around and around. This came from his book, Vets might fly, if my memory serves me correctly. The phrase could possibly have evolved from this practise. That is another possible explanation.
Solution 2:
The American Heritage dictionary of idioms writes:
This expression, first recorded in 1771, is thought to allude to the cat-o'-nine-tails or "cat", a whip with nine lashes widely used to punish offenders in the British military.
This section in Origins of the Specious: Myths and Misconceptions of the English Language recognizes that the above is the typical story, but argues that the phrase is in fact earlier:
So the "cat" may have originally been a literal cat, which in Elizabethan times was used as a toy. However, more sources like to report that the phrase really does refer to a whip. Either way, the phrase seems to be earlier than the American Heritage Dictionary reports.