The purpose of the debates is to give the audience the opportunity to directly compare the positions of the candidates.
Having the candidates ask questions to each other would not be useful for that, because
- Not all participant will answer the same questions, so there is no direct comparison.
- The participants would mostly choose questions which do not have the intention to learn more about the viewpoint of the other candidates. They would likely use the opportunity to ask loaded questions with the intention to lead the other participants to defame themselves and not constructive questions which help to further the debate.
- It would lead to a back-and-forth of such loaded questions circling around a subject where each participant wants to be the one to ask the last question. There would be no way for the moderator to break up this cycle without discriminating one of the participants.
- When the debate has a specific focus, participants could ask questions which are off-topic to lead it into a direction which is more comfortable for them. The moderator could try to intervene, but that would likely just lead to an even less constructive meta-debate: "I know we are talking about foreign policy, but America deserves to know why the other candidate is beating his wife! ... No, I will not retract the question, in the name of all victims of domestic abuse I must insist on my opponent answering this question... what do you mean it's not about foreign policy? I am asking in the name of abuse victims worldwide!"
Having a neutral party ask the same question to each participant is a far better way to provide the viewer with a direct comparison. A good (!) moderator will also choose and phrase the questions in a way that it gives the participants a fair chance to present their viewpoints without having to waste time with reframing the question to diffuse any hidden attacks in them.
Note that during the preparation phase of such debates, the candidates and their teams usually get the opportunity to suggest which questions to ask, so the candidates can use this to raise questions which will be comfortable for them but uncomfortable for their opponents.