Alexander Graham Bell, who was awarded the first US patent for the telephone (fourteen years after Johann Reiss demonstrated a working telephone), thought that what you ought to say when beginning to speak into one was “ahoy!” This caught on in a small way for a while, but was quickly replaced with “hello,” a relatively new word adapted from what English fox hunters shouted as they galloped across fields.
“Ahoy” has a slightly longer history than “hello,” but was originally a similar sort of word; something you would should loudly to alert people. In the case of “ahoy,” as you’d expect, it was used aboard ships to get attention — for example, from the other ship that was going to crash into yours if they didn’t turn.
However, the need to shout something goes back much further than the 1700s (ahoy) or 1800s (hello). The predecessor of “hello” was something like “haloo,” just like “hoy” or “oy” were around before “ahoy.” “Hoy” first appeared in print in the 1300s, and was something herdsman would yell at their cattle or sheep to hopefully keep them moving together in the right direction. There are notes here and there that boatsmen would yell the same thing to each other, or to shore.
The idea that nobody was really yelling “ahoy” until about 1750 doesn’t really hold up; there must have been some folks mixing it in with “hoy.” It’s just that nobody wrote it down at the time. Or if they did, they dropped their notes overboard when their boat was rammed by another one because nobody was yelling at them.
Both “ahoy” and “hello” have been adopted from English into other languages. This isn’t all that unusual now that English is so common, but this happened in the 1880s, when “ahoy” appeared in Czech (“ahoj”), first as a command for horses pulling a wagon or sleigh, then as a greeting. “Ahoj” is still Czech for “hello”.
There isn’t really all that much difference between “ahoy” and “hello.” As the Baltimore Weekly Register recorded in 1811: “Commodore Rodgers hailed ‘ship ahoy!’ Was answered, ‘halloo.’” And as for product naming, such as a certain chocolate-chip cookie popular in the US, that’s not original either. This is in the novel All Year Round, published in 1860: “Chips ahoy! Old boy!”