The phrase describes a space so confined that there is not enough room to perform even the most basic physical actions. A tiny studio flat with no room to swing a cat is painfully cramped. An overcrowded meeting room with no room to swing a cat makes productive work nearly impossible.
The 'cat' in this phrase is almost certainly not the domestic animal but the 'cat-o'-nine-tails' — the multi-stranded leather whip used for flogging in the Royal Navy and British Army. The whip was approximately one metre long with nine knotted tails, and required significant space to use effectively. Naval punishments were carried out on deck, not below decks, specifically because the lower decks of a warship were too cramped — there was literally no room to swing the cat.
The phrase appears in Samuel Pepys' diary in the 1660s and in various 17th and 18th century naval accounts. Some scholars argue for the literal cat interpretation — that swinging a cat by the tail was a test of space — but the naval whip origin is more consistent with the documented contexts where the phrase appears. The whip itself was nicknamed 'the cat' and flogging was a common enough feature of life in the 18th century navy to generate lasting vocabulary.
Yes. The cat-o'-nine-tails was the standard flogging instrument in the Royal Navy until the 19th century. Floggings were public events, read out from ships' logs, and documented extensively. The phrase 'cat out of the bag' may also relate to this same whip.
Occasionally it is used figuratively to describe time or administrative space — 'no room to swing a cat in this schedule' — but the primary and most common use refers to physical cramped conditions.