Yoda’s exact reasons for going to Dagobah are never revealed in the Star Wars movies.
As most of you know by now, Yoda was exiled to the swampy and remote Outer Rim planet of Dagobah after his confrontation with Darth Sidious in Star Wars: Revenge of the Sith. The exact reason why the Grand Master of the Jedi Order left the galaxy this way and left it in the hands of the Emperor is never revealed in the movies. His reason for choosing Dagobah is not well explained as it is one of the strangest and darkest worlds in the galaxy. Fortunately, all of these questions have been answered in the non-cinematic Star Wars material, lore and current canon.
Yoda could not defeat Palpatine
In Matthew Stover’s novel Revenge of the Sith (part of Today’s Legends), Yoda’s battle against Palpatine is given more details. As the last Grand Master of the Jedi Order, Yoda was a master of combat and a prodigy in his military. Despite his power, he was not strong enough to defeat Jedi Master Palpatine, forcing the Jedi to retreat, hurting his pride beyond repair.
In the novel it is explained that the two characters represent the Jedi and the Sith. Yoda’s defeat is also symbolic and reflects the state of his power at the time. As the Jedi (the light side of the force) disappeared, the Sith (the dark side of the force) grew stronger until they took over the entire galaxy.
The defeat of the Jedi was not only due to the machinations of the Sith, it was also their fault. For a while now, the Jedi have lost their way and don’t represent what they say they are. They couldn’t even see that they were being manipulated by the Sith Lord who controlled the entire Galactic Senate, they were blind and oblivious. Yoda realized too late that the Order needed reform. As the leader of the Order, the defeat of the people and the rise of the Sith was almost entirely his fault.
Although Yoda and Obi-Wan Kenobi went into exile, they weren’t just outrunning their enemies and destroying the galaxy. The two masters had a plan based on the descendants of Anakin Skywalker. They realized that a new generation was needed for the return of the Jedi, but training Luke and Leia from a young age was too dangerous. That’s why they decide to split them up, Leia will be adopted by the Royal family of Organa and the Alderaan family, while Luke will go to Tatooine with his uncles. The idea was to wait for the right time for the two young men to train as the first Jedi of a new and improved generation.
We already know the rest. Luke Skywalker proves to be a true Jedi Knight, his decision to redeem his father rather than kill him serves to save the galaxy. He later trained his sister Leia and built the New Jedi Order.
Yoda’s training
Another reason for the migration of the Grand Master of the Order was to continue his training. At their respective hideouts, Obi-Wan Kenobi and Yoda interacted with Qui-Gon Jinn’s force spirit, who trained them to return as spirits after their deaths. Just because they have the title of teacher doesn’t mean they don’t have new things to learn.
In the new Star Wars canon, particularly the Clone Wars series, Dagobah is described as one of the purest planets in the galaxy. This helped Yoda not only connect with the Force and continue his training in the Force, but also connect with other Jedi in the galaxy. In Star Wars Rebels, it was shown how Yoda had a brief encounter with Ezra Bridge when he was about to become a Jedi Knight.