I am not a native English speaker; I am not sure how to interpret such an event. For example, suppose I approach my friend to say hello; suppose he is together with someone I don't know; suppose this someone says "who is this" in normal tone to us. Then should I assume that this someone is not a friendly one? Or is it just a way to start a conversation popular for young people?
Knowing the underlying implicit rule is not just about I-assuring-myself thing; I do not hope I misuse this phrase to offend someone else unknowingly to myself :).
Best Answer
This is a fairly nuanced question and warrants a more detailed answer, in my opinion. None of the other answers address passive-aggression. I know this is a lot of information, but I hope it helps some.
Short Answer
Definitions
These are fairly complex concepts; there's no need to read the entire articles. However, if you want to get better at interpreting people's social behavior, you would do well to understand these things on a basic level.
Note that while introversion is not necessarily rude or passive-aggressive, the behaviors of introverted people are often interpreted as such, which is why I've defined all three here. It's perhaps the most difficult of the three to understand.
More Detail
Given the above definitions and what you've described, this does not sound rude to me, as the person in question was not confrontational. It would have been rude to say to you, "What do you want?!", or, "Who's this schmuck?" as those are confrontational.
Turning to your friend and asking for your name could simply be preparation for formalities. If it's in a professional setting, it could simply be the person wanting to address you by your name, know your position/department, or something similar. They wouldn't want to be overly casual with a director or manager, or overly formal with an intern.
If you sensed hostility from the person, passive-aggressive behavior more closely fits the bill in the situation you've described. While it is sadly common among American young people, this is dangerous to assume.
In general, try to give the benefit of the doubt (i.e. take the most positive interpretation in uncertain situations) when meeting new people. I would interpret this as introversion until they display signs of one of the other two descriptions (i.e. rudeness or passive-aggressive). It's quite harsh to judge a person as "unfriendly" in general based on such a short interaction. It depends quite a bit on the context and the person's body language/tone, as others have said. I think you'll know with more certainty which it was once you know the person better.
The "Expected Behavior"
The "proper" thing for this person to do, in modern society, would have been to address you directly with an introduction. Something like:
As pointed out by @StephenR (in the comments), it's more traditional for your friend to make the introduction.