Your second alternative,
"We know which his favorite kind of candy is", would be fine. Apparently, it wasn't an option on your exam.
Your first alternative,
"We know which it is his favorite kind of candy", is wrong because it uses two pronouns, "which" and "it" to refer to one nominal phrase "his favorite kind of candy".
A problem with many multiple-choice language tests is that they don't and can't offer all possible grammatically correct answers. Those taking the test must choose the best answer from the ones offered in the choices.
You are puzzled about why "We know which is his favorite kind of candy" is correct. This clause would answer a question like
"Which is his favorite kind of candy?" Once again, answering
"We know which/what his favorite kind of candy is" would also be correct.
I don't have a good rule or explanation for why it's also correct to say
"We know which is his favorite kind of candy", but I can tell you that it is also possible to preserve the position of the pronoun and the verb in the question
"Which/what is his favorite kind of candy?" in the indirect clause.
Unfortunately, your exam chose a fairly rare construction for the "correct" answer among its choices.
I couldn't find a single example in the TMC for "I know which is..." or "I do not know which is..." in that corpus of one hundred million words.
Looking in the much larger collection of language in Google, I found very few examples of the version that was one of the options on your test. Here's one from a biography about
Truman Capote:
"And I know which is is his window."
I had to wade through an article and some inane replies in a blog to verify this one from
"The Independent", a publication from the U.K. Here it is:
OR if I see something in my FAVourite shop Tkmax reduced (I know which is his favourite brand) I'll buy it him ...
Here's one more from
"Totally Les Mills":
Wow, so now I know which is his office, right next to the Marketing Director’s office.