This slang phrase became popular in the U.S. in the 1920s. In those days the word “cat” was used to describe unconventional flappers of the jazz era. It was then combined with “pajamas” (a relatively new women’s fashion in the 1920s) to describe something that is the best at what it does, thus making it highly desirable and eagerly sought.
The phrase must have been popular. The New York Times, in 1922, reported a publicity stunt by an unknown woman, in which she paraded along 5th Avenue clad in yellow silk pajamas and accompanied by four cats similarly dressed.
In the 1920s, dozens of nonsense phrases combining an animal with a part of the human body or a piece of clothing were used by the cool kids. Here are several, all with the same meaning as ‘the cat’s pajamas’:
the bee’s knees
the cat’s meow
the dog’s bollocks
all that and a bag of chips
the snake’s hips
the gnat’s elbow
the elephant’s instep (or wrist or arches)
the cuckoo’s chin
the duck’s quack
the eel’s ankles,
the bullfrog’s beard
the leopard’s stripes
the sardine’s whiskers
the clam’s garter
But does such a phrase mean anything?
Etymologists don’t have a firm answer. It might just be nonsense that some hipster kid came up with. Or it might be a mondegreen, originating from the mishearing of some other phrase.
I’m not the only one who thinks such phrases are fun. The Cat’s Pajamas is a 1926 American comedy silent film and the same title has been used for a music band, a song, a night club, and a hostel, to name just the ones I saw at a quick glance.