The difference between asking Qu’est-ce que tu veux? (What do you want?) in French and Qu’est-ce qui est arrivé? (What happened?) is a matter of whether the interrogative what is the object of the verb or the subject of the verb.
Qu’est-ce que asks what when what is the object of the verb — that is, when it receives the action. In Qu’est-ce que tu veux?, tu (you) is the subject of the verb, so there can’t be another subject. Because the interrogative qu’est-ce que can’t be the subject, it must be the object. Here are a couple of other examples:
Qu’est-ce que vous voyez là-bas? (What do you see over there?)
Qu’est-ce que c’est? (What is it?)
Qu’est-ce que has a short version: que. However, if you want to use it, inversion must follow, which makes your sentence sound a bit pompous to French ears. Here are the two previous examples from before with the short version:
Que voyez-vous là-bas? (What do you see over there?)
Qu’est-ce? (What is it?)
With qu’est-ce qui, what is the subject of the verb. The sentence Qu’est-ce qui est arrivé? (What happened?) has no other subject. Qu’est-ce qui does not have a short version.
Follow these steps to choose between qu’est-ce que and qu’est-ce qui:
Find the verb of the sentence and look for its subject.
If you can’t find a noun or pronoun acting as the subject, the sentence probably doesn’t have one, in which case what is the subject in your question.
In that instance, use qu’est-ce qui.
If you do find a subject other than what, then what is the object of the verb in your question.
In that instance, use qu’est-ce que.
When a question begins with que/qu’, it’s always asking about a thing.
As an example to illustrate the need for the subject what, start from a statement you may hear:
La pluie a causé la rupture du barrage. (The rain caused the break of the dam.)
Then imagine you didn’t hear the first words. You’d be left with this incomplete sentence:
. . . a causé la rupture du barrage. (. . . caused the break of the dam.)
But you really want to know what caused the dam to break, so you ask just that, using qu’est-ce qui because the what is the subject of the sentence.
Qu’est-ce qui a causé la rupture du barrage? (What caused the break of the dam?)
Note how the first qu- in both qu’est-ce que and qu’est-ce qui never changes. The qu- word that alternates between qui and que is the second one.