This phrase generally means that something is good or of high quality. The phrase originates from the roaring 1920s.
In the 1920s the term “cat” was used to denote the unconventional flappers from the jazz era. A flapper generally meant a women who smoke, drank, danced and even voted! These young girls grew out of the First World War and took up the ideals of the feminist movement. These young girls were the trendsetters of their day. The term “cat” was combined with pyjamas, which were a relatively new fashion, to form this phrase. It described something that is best at what it does.
In the 1920s it was popular to combine an animal with a part of the human body or an article of clothing. Generally, these phrases meant that something was excellent. Some examples include the monkey's eyebrows, the snake's hips, the clam’s garters, the eel’s ankles, the gnat’s elbow, the pig’s wings, and of course, the bee’s knees.