Not only an insult, its also used in lots of unserious ways. Quite versatile.
Get into an argument and the other party turns out right? You can have "nah" pulled at you (jokingly).
You can also have it done at you at times you dont expect, and it being unexpeced makes it funny.
The alt text has an explanation. Couldnt figure out how to copy it to this comment.