Google can help with things like this, you know :)
The first Google hit says:
A bee’s “corbiculae”, or pollen-baskets, are located on its tibiae (midsegments of its legs). The phrase “the bee’s knees”, meaning “the height of excellence”, became popular in the U.S. in the 1920s, along with “the cat’s whiskers” (possibly from the use of these in radio crystal sets), “the cat’s pajamas” (pyjamas were still new enough to be daring), and similar phrases which made less sense and didn’t endure: “the eel’s ankle”, “the elephant’s instep”, “the snake’s hip”. Stories in circulation about the phrase’s origin include: “b’s and e’s”, short for “be-alls and end-alls”; and a corruption of “business”.
The second Google hit continues by noting that no one really knows who started it, and that the first found occurrence of its current usage came from a paper in 1922, but they were only noting that the phrase existed, they did not define it. They go on to theorize that it may have come from an attractive woman at that time, Bee Jackson, and thus “the bees knees” meaning awesome would come from her being attractive. I think this is somewhat plausible, but also a bit far fetched.
I guess bees do have knees, as demonstrated by this picture. Although I’m not sure if one can call a bend in a leg a knee. I’m sure a bee’s knee does not function completely like a human’s knee.