These are called subject questions (as your first example) and object questions (as your second). Here we are talking about "do", so this is present simple and past simple tense. Let us take one example:
Paul wants to speak to him.
1) If we want to know who "him" is, "him" is the object and the question we will ask is an object question. There will be an auxiliary verb, which will come between the question word and the subject:
Who does Paul want to speak to?
2) If we ask a question about "Paul" (the subject), however, it will be a subject question, and then all we need to do is substitute the subject with a question word:
Who wants to speak to him?
Further reading with examples: in this grammar book
3) It is possible to add an auxiliary verb in subject questions, that has already been discussed here. To sum it up, it adds emphasis, as in:
A: Who wants to speak to him? Jack?
A: Well, then who **does** want to speak to him?
More examples of that can be found in the link.