Short answer? N'kata Del Gormo.
Turns out we don't know much about Yoda or his past. But here's what we do know. At some point in time, Yoda and a human friend got some junky spaceship and tried to leave whatever planet they were on to find work in the core worlds. Ill-prepared, Yoda and his friend nearly died as their ship malfunctioned and they were stranded, drifting in space. Before being taken by the vast black emptiness, however, Yoda was able to crash-land his broken vessel on the nearby, swampy planet known as Dagobah.
It was then that Yoda was discovered by the strangely snake-like Jedi Gormo. The rest, is history.