It is a set phrase used informally in the United States (and perhaps elsewhere, I don't know) to greet someone you haven't seen in a long time. Usually you'd use it with someone who is just an acquaintance, not someone you deeply missed during their absence. It is used kind of jokingly, with a big smile, since it sounds a bit silly/corny/old fashioned.
You might say it to an old acquaintance from college you hadn't kept in touch with, if you ran into them somewhere.
-- "Excuse me, didn't we take organic chemistry together? You're Kim, aren't you?"
-- "Yeah, you're Chris, right?"
-- "Yeah, wow, long time no see!!! What has it been, six years? Where are you living these days?" etc.
Maybe I just don't understand what your second question means. I can't think of a negative way to greet someone informally. You could say something like, "Hey, jerk!" to show that you're not happy to see them. But usually you don't want to antagonize or anger someone you are about to start a conversation with. :)
Other jokey, informal ways to greet someone in the USA you haven't seen in a long time are "We meet again!" (this phrase seems very formal, but you're making fun of its formality) or "Where have you been hiding?" (as if they were a little kid playing hide and seek).