There's not really a good explanation for how it started, unfortunately. It was part of a popular series of phrases in the 1920's about animals and body parts including the bee's knees, the snake's hips, the clam's garter, the eel's ankle, the elephant's instep, the tiger's spots, the leopard's stripes, the sardine's whiskers, and the pig's wings. Whoever first came up with cat's pajamas might have chosen the word "pajamas" because pajamas were new and cool in the 1920s, but basically, they were just going with the flow. Personally, I'm glad "cat's pajamas" stuck around instead of "elephant's instep."