Ciao is the most famous Italian word. Even if it will sound strange, it entered the Italian language only in the twentieth century.
It comes from the Venetian word s’ciao, meaning “[I am your] slave” and it implies putting oneself at the disposal of the other person. It was therefore a reverential salutation, similar to the servus in use at the Austrian Imperial court.
Nevertheless, from the nineteenth century it spread as informal greeting first in Lombardy, where it took the altered form. Evidence is found in the “Dictionary of the Venetian dialect” by Giuseppe Boerio (1829), in which it is described as a “way to greet others with a lot of confidence.”
Its first appearance in a literary work dates back to 1874, in a Giovanni Verga’s novel entitled “Eros”: «Ciao! Alberto le fissò addosso un lungo sguardo, che valeva per lo meno quanto il ciao» (Hello! Alberto gave her a long glance, which had as much meaning as the hello”.)
Nowadays in Italy it is the most common greeting used among friends and acquaintances.
Abroad I heard many people saying it to say goodbye, whereas In Italy it is used both when we part and when we meet (probably more when we meet, actually). It also happened to me that many people greeted me using ciao. It sounded very weird because in Italy we don’t say it to people we don’t know, or that we have just met, but only to persons we know very well or with whom we feel a certain bond.
Sometimes it is also used ironically to emphasize the fact that something is too hard to do, or that you do not believe the words of someone. In that case, with a sarcastic tone we say: “Sì, ciao!” (Yes, bye!) or “Va be’, ciao!” (Ok, bye!) to say “it’s impossible or unbelievable“.