At the end of Star Wars: Episode III - Revenge of the Sith, Yoda exiles himself to Dagobah after his devastating defeat against Darth Sidious. He remains there for decades until Luke finds him in The Empire Strikes Back. The exile was a punishment, resulting from Yoda's perceived failure as a Jedi Master; however, one Tumblr user has another theory: Yoda wasn't an exile on Dagobah; he was an apex predator.
Source:https://www.cbr.com/star-wars-theory-yoda-dagobah-apex-predator/