When do you use wie and was in German?
What is your name?
I understand you ask the question with wie instead of was.
Wie means how, and was means what.
But the confusion arises from the fact that the same idea is rendered differently in English than in German.
In English, we say, "What is your name?". The literal German translation is "Was ist dein Name?".
But in German, we say, "Wie heißen Sie?" or "Wie heißt du?" (respectively, formal and informal). And the literal English translation is "How are you called?"
Other expressions also have different renderings. "Ich habe Hunger" literally translates into "I HAVE hunger", but the English equivalent is "I AM hungry".
"Wie" means how and "was" means what. In general, you can translate them that way, but as you noticed, there are some special cases that you learn best by comming across them and looking them up.
Translating "what is your name" would literally result in "was ist dein Name". This actually is a valid sentence/question!
"Wie heißt du" might be a bit more common, but "wie" makes sense here. How something "heißt", makes the something valid: if "A heißt B", A is called B. Now you can also ask what A "heißt": "was heißt A", which translates to what does A mean.
-- "When do you use "wie" and "was" in German?" --
In general we use those words similar to English. We ask wie when we want to know how something is and we ask was if we want to know what something is.
For some abstract things the two languages handle it different if you ask with wie/how or was/what and sometimes they're equal. In many cases both languages support phrases for the same thing with both words (with sometimes a subtle different meaning):
Woran denkst du? - Where is your mind? (*)
Was denkst du? - What do you think?
(*)Note: If you ask What's on your mind it expresses - imho - that something weighs someone down while Where is your mind does not.
In case of name English is different to German, but note that in other languages may also be different ways to ask. In Russian they ask with как(how), in French with comment(how) or quel(which/what) and in Spain and Italian I think it's similar to French.
B2T - In German we usually ask:
Wie heisst du?
But those are also possible (but are less in use):
Wie ist dein Name?
Welchen Namen hast du?
Wie lautet dein Name?
And if you ask Was ist dein Name? I think that's absolutely OK, because it has almost as many hits on google as Wie ist dein Name? but, though, I would never say that.
Summarized: In case of name it's much more usual to take wie or welchen rather than was, but in general (and that was your first question) it's not possible to give a clear answer. For every abstract thing the way how you ask can be different and there is no rule (and also no rule of thumb). It's something which is developed with time. Fortunately, it's often the same word.
The difference between the two mainly has to do with the verb being used or the action taking place. To ask for someone's name in German, you are really asking "how" they are called or how their name is called, not "what" their name is like in English. Look for what verb is being used or implied to help determine which is correct.
The problem with
Wie ist dein Name?
is, that funny people could just answer:
or something, because in a strict sense the "Wie" asks for properties of things (among others). (Of course, you could argue that the name of the name of Frau Schmidt is "Schmidt", but "Wie ist der Name deines Namens?" is, of course, almost impossible.)
I therefore recommend, to use "Was" or simply
Wie heißt du?