You can certainly ask "What did happen last night". However, the meaning changes to one of emphasis. The question asks not only what happened, but in contrast to some earlier discussion where something else was said not to have happened.
In the exasperated "Who does want to eat", it is the same situation: emphasis.
We also need the auxiliary, if the WH-word subject is paired with the verb "do":
- What {did you do | did you*} last night.
The * marked form sounds archaic. This construction probably occurs to avoid a perceived ambiguity: "what did you last night" sounds as if "did" is still auxiliary, and the verb is missing. "What did I what last night? What did I eat? What did I watch on TV? Oh, you're asking me what I did, in some outdated way of speaking; very funny!"
(Some uses of this word order in questions still occur in British English, I think, such as, "Have you the time?" "Had you enough to eat?" Children all over the English speaking world continue to pick up the syntax from nursery rhymes: "Baa baa black sheep, have you any wool?")
Note that since the "did" is required in "what did you do yesterday", it is possible to use it with or without emphasis:
- What { did* | did } you do yesterday? [Emphasis: I already know what you didn't do; please give me the contrasting information: what you did. No emphasis: inform me about your yesterday's activities.]
We can also put the emphasis almost anywhere in the above sentence: we can emphasize "did", "you", "do" or "yesterday", in order to make any of them the focus:
In our earlier sentences, we cannot use "did" without emphasis:
It is possible for another word to be emphasized simultaneously, in some very specific contextual situation where things are being contrasted in parallel pairs, or something of the sort:
- Okay so we established what didn't happen to Joe; so what did happen to Bob? [The focus is on Joe and Bob, and on what did happen to the former and didn't happen to the latter: two things in one sentence contrast pairwise with parallel things in the other.]
The first form, Why did you close that and open this? is correct. (The use of both the question mark and the exclamation point together is non-standard, though.)
Interrogative sentences in the past tense are formed by did + unmarked infinitive. It may be easier to see the pattern if you split the question into two sentences:
- Why did you close that?
- Why did you open this?
Best Answer
All full questions* require a finite auxiliary verb† (that is, an auxiliary verb tensed for either past or present) before the subject. When the verb in the sentence is a construction with an auxiliary, this is accomplished by switching the subject and the auxiliary. When the verb is a lexical verb with no auxiliary, it is accomplished with DO-support: the tense is removed from the verb and put on a form of DO before the subject:
Your second sentence, however, confuses two different constructions. There What is not an interrogative, a question word, but a relative pronoun heading a clause which acts as a noun phrase. The statement form would be:
Consequently, the question form would be:
* As Peter Flom points out, questions may be truncated very substantially in discourse context.
† BE is always considered an auxiliary, even when it is the only verb.