This question means "Why are you here?" But "Why are you here?" sounds rude and accusatory (it sounds like you're accusing the person of doing something wrong). You ask "What are you doing here?" when you see someone that you didn't expect to see in that place.
This phrase is pronounced with stress on the word "you":
What are you doing here?
If you give this sentence the wrong intonation, it can sound rude as well. Use a high intonation for "you" and remember to smile!