FIRST, just wanted to differentiate what you might READ from what you might HEAR:
Correct, written: What are you doing?
But, often, spoken: Whatta ya doing? (i.e. the auxillary "are" gets reduced and you almost don't hear it)
The rules about what is correct in speech are often looser than in written English, but in this case, the rules apply; the correct answer is "What are you doing?" but note that you might hear it differently in conversation.
SECOND, this is a wh- question in the present progressive.
DO is the main verb
ARE is the auxilliary verb
The subject is YOU
The answer to your question is about syntax (word order) rules.
Basic sentence > You are doing.
When you add a WH-question, the subject (you) and the auxillary verb (are) switch position.
Wh- question >What are you doing?
A few related examples of this subject/verb switching with Wh- questions in the present progressive form...
Jane is arriving now.
When is she arriving?
I am eating a sandwich.
What are you eating?
That's a long answer but you wanted to know why. Hope this helps!~ There is no short reply -- what you asked is actually a very good question.
"...and why?" is ALWAYS an interesting question :-)