It's actually the Harvest legend. John Barleycorn represents the spirit of the Barley, grown strong over the summer, cut down in his prime, ground and brewed into beer where he lives again.
JB is central to most agrarian cultures in some form or another, much the same as the Green Man is... The specific form that most people seem to know today is generally either an English or German incarnation.
So to answer the question, "John Barleycorn" is a metaphor of several levels... it's a metaphor for the growing and harvesting of the barley, it's a metaphor of sorts for the harvest cycle, and some feel that it's also a metaphor for life itself.
Hope this helps...