The Oxford English Dictionary says the first published use of "hello" goes back only to 1827. And it wasn't mainly a greeting back then. Ammon says people in the 1830's said hello to attract attention ("Hello, what do you think you're doing?"), or to express surprise ("Hello, what have we here?").
Where did the word hello originate?
Etymology. According to the Oxford English Dictionary, hello is an alteration of hallo, hollo, which came from Old High German "halâ, holâ, emphatic imperative of halôn, holôn to fetch, used especially in hailing a ferryman".
What was used before hello?
Hello wasn't used as a greeting until many years later when the telephone was invented. ... Instead of hello, he preferred the word “ahoy." While ahoy may sound funny to us today, the word actually had been used as a greeting for a long time among sailors.