In a short but clear way:
"O que" means "the one/that (one)/this (one) which/who/that (what/who/he who)" in affirmative sentence and "what" in questions. "O que" cannot be followed by a noun: for that, you must use only "que". In interrogative questions, you can replace "o que" by "que" only.
"Qual" (without "o" before) is used only in questions and indirect questions (and related) and means "which" (one among a group). "Qual" may be alone or folowed by a noun. The group out of which you have to do your choice is not so restrict as in English and sometimes you have to translate "Qual" by "What".
1) O que queres que te dê? Que queres que te dê?
2) Que carro queres que te dê?
3) Qual queres que te dê?
4) Qual carro queres que te dê?
1) What do you want me to give you?
2) What car do you want me to give you?
3) Which do you want me to give you?
4) Which car do you want me to give you?