Origin of "How are you?"
Solution 1:
'How are you?' and its rivals in the 1600s
One early instance of "How are you?" as a greeting appears in William Killigrew, Selindra: A Tragy-Comedy (1666):
Poll[idor]: [to Ordella] Madam, I was surpriz'd by your approach, which made my tongue appeare lesse ready than my heart to obey you, your commands, Madam, are sufficient to dissolve any vowes of mine, and since you will vouchsafe to hear, I shall relate.
[Phillocles and Selindra come to them.]
Phill[ocles]: How are you Sir? Methinks your Eyes do shew some anguish in your wounds, do we not trouble you?
However, that wording does not seem to have been the most common form of greeting at that time in England. Thomas Herbert, Some Yeares Travels Into Africa & Asia the Great (1638) provides a series of common English introductory greetings in English, with their Persian equivalents, and "How are you?" does not appear. Here is the English version of the dialogue:
A good morrow or God Blesse you Sir.
The like I with you Sir,
Whether doe you goe?
Not farre
How doe you today?
Well I praise God
Good, I am very glad thereof,
Where have you beene?
Now I am your servant
Welcome, Sir, heartily welcome.
Tell me, how you doe? healthie
Where is your house? at Babylon
Have you a Wife?
Yea truly, fifteene Sir,
and so on.
A similar series of French/English dialogues appears in Mrs. Mirge et Boyer, Nouvelle Grammaire Angloise (supposedly from 1600, but undated in the photocopied book and perhaps as late as the early 1700s), including this exchange (English version only):
Good morrow, Sir.
Your Servant.
I am your Servant.
I am yours.
I thank you.
How do you do?
How do you do, this morning?
Very well.
At your service.
How are you in health?
How is it with you?
Ready to do you service.
And you, Sir, how do you do?
Very well, thank God.
and so on.
In this exchange (or series of possible exchanges), the question How are you?" is elaborated as "How are you in health?" which might be the full version of the original question that became truncated to "How are you?" sometime later, but I found very little evidence to substantiate that hypothesis. In any event, the more common inquiry in this period seems to have been either "How do you?" (asked twice in Herbert's dialogue) or "How do you do?" (asked twice in Mirge et Boyer's dialogue.
'How are you?' in the first half of the eighteenth century
In the first half of 1700s, "How are you?" seems to have become fairly well established. Two examples come from Jonathan Swift's letters. First, from a letter from Swift to Sheridan (August 3, 1723) in Swift, Miscellanies, volume 10 (1745):
How are you this Moment? Do you love or hate Quilca the most of all Places? Are you in or out of Humour with the World, your Friends, your Wise, and your School? Are the Ladies in Town or in the Country? If I knew, I would write to them, and how are they in Health?
And second, from a letter from Swift to Lady Acheson (April 1, 1732), in Letters Written by Him and Several of His Friends (1768):
Are you not undone for want of Monky? How are you? Does your milk agree with you? We shall see you no more at church until Monky returns.
From a table of words of one syllable in P. Sproson, The Art of Reading: Or, the English Tongue Made Familiar and Easy to the Meanest Capacity (1740):
how are you to day
From The Trial in Ejectment Between Campbell Craig, Lessee of James Annesley, Esq; Plaintiff and the Right Honourable Richard Earl of Anglesey, Defendant (1744):
Q. Who said it was my Lord's [the earl's] Child?
A. The Country had laid it to him. And so, said I, Juggy, how are you? I'm very sick, says she. What ails you? I have got a Child. Whose is it, says I? It is my Lord's, says she. I believe then, says I, my Lord is very kind to you now, Juggy.
And from a 1748 translation of Terrance's Comedies:
Gnat[ho]. Gnatho greets his dearest dear Friend Parmeno with his best Wishes: how are you?
Par[meno]. On my Legs.
Gnat[ho]. Pshaw, I know that : —— but dost thou see Nothing here that thou dost not like ?
Par[meno]. Yes, you.
A translator's note to these lines remarks
Quid agitur sometimes means what are you doing? Sometimes how do you? How are you? or how goes the World with you?
Conclusions
"How are you?" appears in Google Books search results as stand-alone question going back to 1666. At the time "How do you?" may have been considerably more common as a salutation; and "How do you do?" provided further competition later on.
Two of the pre-1750 matches that I found for "How are you?" complete the question with "in health?" so it may be that "How are you in health?" was actually the earlier question, shortened to "How are you?" after the phrase became commonplace. It is not clear to me from the data Google Books provides, however, that this process occurred. The only conclusions I can state with confidence is that "How are you?" has been standing alone in inquiries after to a person's health or well-being for more than 350 years.
Update (May 30, 2020):
Earlier instances of "How are you?" as an inquiry after one's state of mind or being
A search of Early English Books Online turns up some matches for "How are you?" that are earlier than the example from 1666 cited in my original answer. Here are the earliest instances, in chronological order.
From Philip Sidney, His Astrophel and Stella Wherein the Excellence of Sweete Poesie Is Concluded (1591):
O Absent presence Stella is not here, / False flattering hope that with so faire a face, / Bare me in hand that in this Orphane place, / Stella I saw, my Stella should appeare, / What saist thou now, where is that dainty cleare / Thou wouldst mine eies should helpe their famisht case: / But how art thou? now that selfe felt disgrace / Doth make me most to wish thy comfort nere. / But heere I doe store of faire Ladies meete, / Who may with charme of conuersation sweete / Make in my heauie mould new thoughts to grow: / Sure they preuaile as much with me, as he / That bad his friend but then new maimed to be / Merrie with him, and so his forget woe.
In this earliest match, Sidney doesn't seem to be asking how the absent Stella is doing, but he is asking "how art thou?" as a freestanding question. On that basis, and not as a proto-example of the greeting, I include it here.
From George Chapman, The Gentleman Usher (1606):
Vincenzio. Alas, twere pitty sir, they would be gulld / Out of their very skinnes.
Bassiolo. Why, how are you my Lord?
Vicentio. Who I, I care not: / If I be gulld where I professe plaine loue, / Twill be their faults you know.
Although one might suggest that the question is not "how are you [feeling], my Lord?" but "how are you [acording to God's plan] my Lord?" later vsions of the play punctuate the line consistently with the first interpretation. Thus, in an 1874 edition of the play, we find the line punctuated as follows:
Bassiolo. Why, how are you, my Lord?
And the identical punctuation appears in a 1970 edition of the play.
From Thomas Middleton, Women Beware Women (by 1627/1657):
Livia. I have tri'd all ways I can, and have not power / To keep from sight of him: How are you now Sir?
Leanto. I feel a better ease Madam.
From a 1655 translation of Madeleine de Scudéry, Artamenes, or, The Grand Cyrus, An Excellent New Romance:
As for Mazares, since he expected nothing but misery, his reason did surmount his passion, and he had no other hopes but to participate with Cyrus in the danger and glory of releasing Mandana, and therefore these promises of the Gods unto Cyrus, the King of Assyria did little fret his heart: 'tis true, he was alwaies so miserable, that Fortune could hardly be more incensed against him then she was, but since he was not lesse prudent then unfortunate, nor lesse generous then prudent, Cyrus began to esteem him infinitely, and keep close society with him; both of them did complain unto each other of the King of Assyria's violent humor, and at last did so accustom themselves unto civility, that they did not only esteem, but think each other worthy of Mandana; yet they never spake of her but sighed, and as they went from quarter to quarter, visiting the gards which Cyrus kept upon all the advenues of Sardis, Mandana was the only object of their discourse, unlesse when they were obliged to speak of something which related unto the Siege. How are you Sir, would Mazares say unto him, in being not only loved by the most glorious Princesse of the world, but also in never having done any thing which might displease her; I wish unto the heavens, that since it was my bitter fate to be hated, that it might be unjustly, and that I could not upbraid my selfe with meriting her hate, by my deceiving her, and carrying her away from Sinope. There is both so much love, and prudence, and generosity, in your expressions Sir, replyed Cyrus, that I would not have my Princesse heare you.
This is an odd instance, and I'm not sure how to interpret it. But it seems to use "how are you" in an open-ended way similar to the modern sense, albeit with a followup narrowing of the scope of the inquiry, as though to say "How are you in this particular respect?"
From Margaret Cavendish, Marchioness of Newcastle, Youths Glory, and Deaths Banquet (by 1662):
Enter Sir Thomas Father Love, brought in a Chair as sick, his Friend by him.
Mr. Comfort Friend. How are you now?
Father Love. O Friend! I shall now be well, Heaven hath pitty on me, and will release me soon; and if my Daughter be not buryed, I would have her kept as long out of the Grave as she can be kept, that I might bear her company.
...
Lovewell. How are you, dear Wife? how do you feel your self now? how are you?
Hypocondria. O very ill; but yet me thinks I can fetch my breath a little better than I could, I believe the Imposthume-bag is fallen down: wherefore I will go to bed.
And from Margaret Cavendish, Marchioness of Newcastle, Matrimonial Trouble: A Come-Tragedy (by 1662)"
Enter the Lady Inconstant.
Lady Inconstant. My dear heart how are you?
Francis Inconstant. Very Sick, so Sick as I fear Heaven doth envy my happiness, and will part us by Death.
From Thomas Porter, The Villain: A Tragedy (1663):
D'elpeche. Did you ever see such Courtship?
Mariane. Not I truly, Sir; for pitty let's relieve her.
D'elpeche. Well, Gentlemen, how are yee with your fair Mistris?
Lamarch. Troth like beginners, how are you there?
Bouteseu. Sure that very young Lady is not so brisk / In her Answers.
These examples show that use of the open-ended expression "How are you?" as a polite inquiry after a person's health in the general sense of "how are you doing?" or "how are you feeling?" goes back at least as far as 1606. Although none of these early examples seem exactly on point as instances using "how are you?" as a simple form of greeting, one can see how small a step in usage that would have been by the middle 1660s.
Solution 2:
Hello seems to come from hallo, a term for calling out to someone or hailing someone. Hi and hey may be contractions of either "hello* or how are you. The correct response to hi, hey, or hello is simply to say hi, hey, or hello back to the speaker, possibly adding "how are you?" A correct response to "How are you?" is "Just fine. How are you?"
Such abbreviated greetings are a modern phenomenon associated with urbanization. The urban environment makes it impractical to have a conversation with everyone you meet. Take, for example, the scene in the movie Crocodile Dundee where the protagonist from the Australian Outback tries to have a conversation with everyone he encounters on a crowded Manhattan sidewalk.
Abbreviated greetings are not limited to English. In Italian, you say ciao to began and end a chance meeting, and this is borrowed into South American Spanish as chau (same pronunciation, different spelling). The question above refers to Chinese people in an English-speaking environment, and I have difficulty believing that city dwellers in modern China do not have one or more abbreviated greetings that they use.
In rural areas, people are farther apart and, before the advent of modern communications technologies, every human contact would have been an opportunity to catch up on the news. There is still an expression in the English language for talking about someone who does not stop to chat on the occasion of a chance meeting: "He wouldn't give me the time of day."
In the 1970s, when I tried to teach myself Irish from a book that was probably obsolete in the '50s, I learned that the correct greetings and responses for meeting people were: "Dia's Muire dhuit" and "Dia's Muire dhuit, agus Padraig." (Please forgive my spelling, you Irish speakers.) It means "God and Mary to you" and "God and Mary to you, and Patrick." This sounds like speech right out of the Middle Ages, and it would have been the start of a longer conversation about crops, or fishing, or news brought by a traveler. Something similar was probably once said in languages spoken throughout the British Isles and continental Europe. But there's no time for that on a crowded city street.