And it wasn't even a greeting in the early years. That didn't come until decades later, with the arrival of the telephone. Thomas Edison urged people using his contraption to say "hello" when answering. Alexander Graham Bell thought the better word was "ahoy" (that word had been around at least 100 years longer). NPR's Robert Krulwich examines the usage, helped by Ammon Shea, author of "The First Telephone Book."
Why did hello succeed? Aamon points to the telephone book. The first phone books included authoritative "How To" sections on their first pages and "hello" was frequently the officially sanctioned greeting. In fact, the first phone book ever published, by the District Telephone Company of New Haven, Connecticut, in 1878 (with 50 subscribers listed) told users to begin their conversations with "a firm and cheery 'hulloa.'" (I'm guessing the extra "a" is silent.)
Krulwich also has a bit about how "goodbye" or "bye" became the way to end calls (the phone book recommended "That is all"). By the way, Mr. Burns from "The Simpson" routinely answers his phone "Ahoy-hoy" (first used as a nautical greeting).