So the phrase "the bee's knees" approximately means "it's fantastic" (my definition at least!). But how did this phrase come about?
It's alliteration of the business, in the sense of exactly what you need to get the job done. But whilst I believe this commonly-held assumption helps the expression retain currency, it's probably not relevant to the original coinage (see below).
In the same vein, a (Cockney) friend of mine habitually refers to an excellent example of something (a fine wine, quality musical instrument, whatever) as the guvnor, where younger people might be more likely to say it was boss.
Admittedly, in this letter to Jonathon Swift (1667 – 1745) from his friend Dr Thomas Sheridan, the good doctor is just flippantly writing in phonetic style - but note I that he writes an ape is till a bout bees knees for an epistle about business. Clearly the aural pun itself isn't a recent innovation.
As regards how and when the bees knees started to be used as a term of approbation, the earliest clear example I can find in Google Books is this from 1923. World Wide Words gives more details of how this expression was part of a relatively short-lived frivolous slang fashion doing the rounds in 1920s America.
That craze spawned a plethora of such "animal/attribute" pairings, including elephant’s adenoids, cat’s miaow, ant’s pants, tiger’s spots, bullfrog’s beard, etc. Which are mostly long-forgotten now, apart from cat's whiskers/pyjamas.
Coarse as ever, we Brits came up with the dog's bollocks about the same time, though I think this was probably unconnected to the US fad.
But even though the US first came up with bees knees, it was actually the Brits who revived it, along with our own dog's bollocks, in the 70s and 80s. In particular, Viz magazine was always fond of these expressions (their hardback 1989 "omnibus edition" was called The Dog's Bollocks). All with due deference, no doubt, to the Sex Pistols 1977 album Never Mind the Bollocks.
Wiktionary Talk has (at the moment, at least):
The bee's knees is an English slang phrase.
The Oxford English Dictionary records the expression "bee's knee" as meaning something small or insignificant from 1797.
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" (pajamas were still new enough to be daring), and similar phrases that didn't endure: "the eel's ankle", "the elephant's instep", "the snake's hip" and "the capybara's spats".
The phrase's actual origin has not been determined, but several theories include "b's and e's" (short for "be-alls and end-alls") and a corruption of "business" ("It's the beezness.")
I found some slightly earlier datings than 1923. The earliest 1907 makes the pun on business, some are just nonsense, and several 1922s are in the form [somebody/something]'s the bees' knees.
Bee-raising is a good side line for the farmer, especially since the swell restaurants have made a specialty of fried bees' knees. Such a beesness!
A probable 1909 in this nonsense in the Lyceumite and Talent:
Lou Beauchamp has "the little woman" with him on his southern tour, and as they sat discussing a luncheon of bees' knees and bears' ears at the Kimball House, Atlanta, yesterday, they both looked as fit as violins.
[somebody/something]'s the bees' knees
A possible 1922 Radio broadcast: Volumes 2-3 suggests it was amateur radio slang:
Another possible 1922 is in The re-ly-on bottler: a ... magazine of ideas and ideals for the ...: Volumes 3-6:
His plant was Modern ; one might almost call it the Bee's Knees. But he couldn't make it Pay in these days when fifty Bucks won't go Further than a Thin Dime would before the War....
A 1922 North Western druggist: Volume 30:
One customer writes : "They surely are the bee's knees. One box sells two," says he.
A 1922 Cosmopolitan:
"Grandpa, you're the bee's knees, for a fact!" the flapper prob'ly says admirin'ly, with a killin' smile.
A 1922 Them was the good old days: in Davenport, Scott County Iowa by William L. Purcell also has a cat's pajamas:
But the 1922 Chicago Dental Society's Bulletin, Volume 3 is the best:
Why not have a heart and become the bee's knees or the elephant's eye-brow or the dog's hind leg or whatever it is which constitutes an honest-to-goodness cat's meow, by registering early and avoiding the main rush ?
A bit of extra information, that notes the origin as New York, comes from the September 1922 edition of The Haberdasher
For the business man on an every-day basis, the neat effects in hair line stripes and the white madras shirts are much worn. New lines of madras and silk are in gray and tan. Soft cuffs are still the "bee's knees," as they say in New York.
I've also tracked down an earlier reference, in the November-December 1920 edition of The National Magazine. It comes from an interview with Ernest Hilliard, who at the time was a 31 year old actor from New York. The film referred to is actually "Annabelle Lee". "Wanamaker's" refers to this building in New York, just for completeness.
Again, this supports New York as an origin of the slang.
For lack of something better, I said to Hilliard, "Well, what do you think of this 'Annabel Lee' picture?"
"It's the bee's knees," he replied. "If it doesn't knock Broadway on its ear, I'll kiss your Adam's applie in Wanamaker's display window at 12 o'clock noon."
In October 1920, The Postal Record includes the following curiosity.
Our long, weary, discouraging fight was won. Justice is to be meted out to a class of employees to whom even common justice has long been a stranger. As Uncle Remus says, "Dat sure am de honey of the bee's knees." The taste of this honey was not as sweet as we expected, due to the fact that two stingers were inserted in it.
My take on that is that somewhere in the Uncle Remus collection of African-American folklore tales is a suggestion that the best honey comes from a bee's knees, perhaps? However, I haven't been able to find any reference to that in any of the Uncle Remus books yet, although there are plenty of references to honey and bees.
A search of newspaper databases turns up one match that is slightly older than the 1907 instance cited in Hugo's answer. From "Musical Notes," in the [Adelaide, South Australia] Register (August 21, 1905):
Even famous experts are said to be occasionally at fault in identifying old violins. However, among the characteristic features of a Stradivarius violin are the bees knees of the pfurling, which are kept closer to the inner corners than in most instruments, and hence display a greater margin of wood on the outer edges of the corners. Then the block pegs are half under the pfurling. showing only one-half. In the F holes the wing is concave and the breast convex, showing the distinct sinking of the wing directly you come to the F hole. Of course, finally and most important of all, there is the tone, and here the expert ear is required.
The word pfurling here is probably a mistyping of purfling, which refers to a narrow strip of inlaid material—often either black or black-and-white—placed along the outer edge of the body of a string instrument for ornamental effect. The meaning of "the bees knees" is unclear, however, since syntactically it is they—and not the "pfurling"—that "are kept closer to the inner corners than in most instruments."
Ultimately, I don't know what to make of this instance of "the bees knees"; and yet it certainly involves early, intentional, and not obviously nonsensical use of the phrase.