Is it correct to say "What was your name?"? The reason I am asking this is, generally the name of the person will not change. One should say "What is your name?"
The question is in the past tense because the person forgot the other person's name. Notice that he actually wrote "Sorry, what was your name again?". It means "You've already told me your name, but I can't remember what it is. Can you repeat?" and not that the name may have changed. If the person used the present tense (i.e. "What is your name?"), it would not have been clear that he knew that he had already asked that before.
Idiomatically, it's quite common for people to ask "What was your name?" even in contexts where both they and you know perfectly well that you haven't already given your name (and thus that they can't possibly have "forgotten" it).
Sometimes the past tense can be "explained" by saying the speaker isn't sure whether the name has already been given. Other times we might suppose if the speaker is looking for a record/document in a filing system, they're thinking in terms of your name when it was recorded (with no particular implication that it might have changed since).
But in practice the usage is sufficiently widespread, and those above possibilities so "precise", that it's unrealistic to suppose all native speakers consider carefully whether the past tense can be justified in any specific context. Some people use it, that's all.
I notice comments suggesting that because superficially the past tense may seem illogical, this somehow leads to the idea that it should be avoided in formal contexts. This I think is completely contrary to actual usage, wherein such use of the past tense is generally more formal.
My reason for saying that is that as a general principle, formal modes of address tend to use many techniques to "distance" the speaker from the current context (using one instead of I, conditional "What would you like?" rather than "What do you want?", etc.).
To my ear, "What was your name?" is in fact "formal" register. Consider a salesman saying...
"I see you're looking at our new range of [product], sir. Did you have anything particular in mind?"
"Did you want to pay by cash or by cheque?"
"Was that all, sir?"
"Will that be all, sir?"
Note particularly those last two. There aren't many contexts where it makes any difference whether the salesman uses past or future tense there - all that matters is that avoiding present tense has the effect of imposing "distance", so it's more associated with formal registers.
"What was your name?" should only be used when asking a person what a previous name of theirs is.
If you have not given your name to someone or they don't remember what you said the proper question to ask is "May I have your name please?".
Now I would not be bothered by someone with authority, say a teacher or police officer, asking "What is your name."
There is no reason to dumb down the English language especially when using it in public or business conversations.
No. It is not correct to ask "what was your name?" because the name has not changed within a few minutes. It is however, correct to ask "what is your name again, please?" The first example assumes the person knows you forgot it and therefore are asking again. Avoid confusion and and ask correctly. "What is your name?" not "what was your name?". There is no carrying over from anything nor should it be passed on to the person you are asking. Say it enough times and the obvious choice becomes well, obvious.