I would like to add that in a question, there might be a light difference in meaning when one selects either "что" or "чего".
"Чего" is often used in more general meaning, "Чего вы хотите от него?" ("What do you want/expect from him?"), "Чего ты хочешь добиться в науке?" ("What do you want to reach in your research sphere?") In case, if there is a specific choice, it is usually used "что": "Что ты хочешь на обед: рыбу или мясо?"
However, there is another, more important difference - it is in style: "чего" is more colloquial version vs. "что". If you talk to a friend, you can say "Чего ты тут собираешься есть? Десерт? Тут хорошие десерты и недорого!" When you talk to a colleague, not a friend, you can say "Что вы будете заказывать на десерт? Что вы предпочитаете?"
Also, the question word "чего" can mean "why", "for what reason": "Чего (= почему) ты здесь сидишь? Уже 10 часов. Ты должен быть на работе!" In this meaning, it has an additional shade of a reproach.