Comparing 吗 and 呢
As you can see above, these two particles are fairly similar. But what are the important differences? Let’s have a look at a few here.
The first difference is that 吗 is only for yes-no questions, whereas 呢 cannot be used in yes-no questions. 吗 always forms these questions, whereas when 呢 is used to form queries, they are open-ended.
The second difference is that 呢 can combine with question words to emphasize a query. 吗 can’t be doubled-up with other question words; it marks questions on its own. For example, 呢 is being used to add a further querying element to these questions:
Nǐ wèishénme bù qù ne?
Why aren't you going?
Tā yǒu shénme bù xǐhuan chī de ne?
What is there that he doesn't like to eat?
Those would both be grammatically valid questions without 呢, but by adding 呢 the speaker makes it clear that they don’t just want an answer to the question - they’re questioning the situation or even criticising it. They’ve added a further query to it.
吗, on the other hand, can’t combine directly with other question words in a statement. If there’s already a question word, it fills up the question “slot”, and there’s no more space for 吗.
The only way 吗 can appear with other question words in the same sentence is if it’s used to ask a yes-no question about a condition. That sounds complicated, but this example might make it clearer:
Nǐ zhīdào tā wèishéme bù chī ròu ma?
Do you know why he doesn't eat meat?
吗 is appearing with another question word (为什么) in that sentence, but it’s not actually part of that question. There are two questions in the sentence here: an inner question about why the person doesn’t eat meat, and an outer question about whether the listener knows the answer to the inner question:
Nǐ zhīdào ma?
Do you know?
Tā wèishénme bù chī ròu?
Why doesn't he eat meat?
吗 really only applies to the outer question, so it doesn’t clash with the question word in the inner one. Other than that kind of situation, 吗 can’t appear directly together with other question words.