Presidential debates would fare a lot worse in television ratings if the candidates simply read essays to the crowd. On the other hand, the crowd would come away from an essay reading with clear, concise ideas that the politicians supported. The crowd would be less entertained, but they would have a full picture of a candidate's supporting arguments.

Essays have a clear structure. A good essay includes an introduction that makes one specific thesis statement clear, body paragraphs with topic sentences that flesh out the ideas from the thesis statement, and a closing in which the arguments are summed up and conclusions are drawn.
While some essays are persuasive, and the arguments in a persuasive essay can be structured in a similar way as one would for a debate, an advocate for the opposing view won't present their side in the middle of an essay. A well-written persuasive essay always considers the opposing views, but those views are still being analyzed by the writer of the essay.
Not all essays, however, are written with the intention to persuade. Essays can be expository, narrative, and descriptive, as well.
Debates usually also feature an introduction, supporting arguments, and a conclusion. The difference is that the supporting arguments do not go uninterrupted and the opposing side is presented by another person. An essay's purpose is to inform, while the purpose of a good debate is to persuade others that you're right and your opponents are wrong.
A good debater already knows the opposing arguments and is prepared to answer counterarguments that mention them. Since those arguments cannot be fully anticipated ahead of time, debates often require more broad research and knowledge than the focused topic of an essay does. The purpose of a debate is always to persuade, and a good debater does so with reasoned arguments, a clearly defined viewpoint, and preparation to counter an opposing view knowledgeably.
Writing an essay can help to form and structure an argument, and it's definitely a clear way to make a point or tell a story. In order to learn to defend your arguments and your ideas, practice debating them with others. Research and writing can inform you on a subject, but no topic is fully understood unless many views of that topic are considered. Sometimes the best way to understand all the different views is to try debating them.