Nazi is obviously a short form of National socialist, or Nationalsozialist to be precise, just as Sozi is a short form of Sozialist. But the word has a much more interesting story than that.
Long before the rise of the NSDAP in the 1920s, people in at least southern Germany could be called Nazi if they were named Ignatz, or came from Austria or Bohemia (where they apparently had lots of Ignatzes); it was supposedly also used as a generic name for soldiers of Austria-Hungary, like the German Fritz or Russian Ivan. It had to be used with caution between friends, though, since it could also mean "idiot" or "clumsy oaf". That's how it found it's way into politics; the fact that Adolf came from Austria (not Bohemia, though) could have made the pun even better. The Nazis supposedly made attempts to include the N-word in their own vocabulary in order to make it less derogatory, but unsuccessfully; since such a maneuver requires a sense of humor as well as irony, it was probably doomed to fail.
"Nazi" was first used in English in 1930, as well as in Swedish, and probably some other languages as well; that's apparently the first year the Nazis made enough fuss to earn themselves the short form internationally. The double sense of the expression, as described above, was unfortunately lost in translation.
An example of pre-hitlerian use of Nazi in southern Germany can be found in a "Bayerische Komödie in 4 Akten": Der Schusternazi, "the shoemaker nazi", by Ludwig Thoma in 1905. The title role is the shoemaker Ignatz Stanglmayer; without giving too much away, he receives a large inheritance, dumps his old friends in favor of some new ones, who turn out to have a piece of valuable russian land for sale, which they offer Ignatz for a friendship price... Und so weiter.