The word ‘hey’ has been around for a good thousand years or so (probably more). A remarkably versatile little word, it can be used in American English in any number of contexts. For example, to express annoyance:
“Hey! Stop doing that.”
Or to express sympathy:
“Hey, now! Don’t beat yourself up.”
Or as a kind of greeting:
“Hey, man! What’s going on?”
By the way, The American Heritage Dictionary has an interesting dialect-related take on that last usage:
Until recently, this greeting had a distinctly Southern flavor. The national survey conducted in the 1960s by the Dictionary of American Regional English found hey as a greeting restricted chiefly to Arkansas, Louisiana, Mississippi, Florida, Georgia, and the Carolinas. The friendly hey has since spread throughout the United States.
I’m not quite sure about that take on things. But if true, it’s perhaps another example of African American Vernacular English making its way into ‘Northern’ speech. (The states listed above strike me as fairly close to the ‘heartland’ of AAVE).
As you can tell in all of these contexts, we often use ‘hey’ as a kind of verbal exclamation point. It’s certainly more useful than screaming in public.
Trying to track down the etymology of ‘hey’ is nearly impossible, though, as The Online Etymology dictionary suggests. It is found in a number of Germanic languages, but was also common in (presumably classical) Latin:
c.1200, variously, in Middle English, hei, hai, ai, he, heh, expressing challenge, rebuttal, anger, derision, sorrow, or concern; also a shout of encouragement to hunting dogs …
In Latin, hei was a cry of grief or fear; but heia, eia was an interjection denoting joy.
I’ve noticed that, despite the somewhat extralinguistic nature of ‘hey,’ there seems something of a growing divide between how ‘hey’ is used in America versus England. In many dialects of the latter, ‘hey’ often equates to American ‘huh?’ That is, it serves as a short hand for ‘what did you say?’ This seems true of Australian English as well, as I discovered thanks to this exchange with a Brisbanian co-worker:
Me: Did you [unintelligible]?
There is a different ‘hey’-like word in Britain (and Australia), of course: ‘oi.’ This is exemplefied by Sir Ben Kingsley’s complaint that he can never set foot in a London pub without someone shouting, ‘Oi! Gandhi!’ (This being Cockney, the latter word rhymes with ‘candy.’)
A number of sources report ‘oi’ as being derived from the Romani phrase ‘oi mush,‘ which more or less means ‘hey you!’ The Romani were one of the immigrant groups who settled in London’s East End, so this explanation seems plausible. The East End was also the refuge of many Yiddish-speaking Jews, of course, who may (or may not) have reinforced ‘oi’ with they’re strikingly similar ‘oy*.’ Words like ‘hey’ and ‘oy’ don’t seem confined to one language.
One rather notable thing about such little exclamatory words is that they all seem to feature diphthongs. I’m thinking not only of ‘hey’ and ‘oi,’ but also of ‘ow’ (an English exclanation of pain) ‘ai’ (an exclamation of pain in many Romance languages), and bringing things full circle again, ‘oy’ (a Russian exclamation of pain). What is it about diphthongs that are so expressive of basic emotion?
*Yiddish ‘oy’ has a more exasperated tenor.