Answer:
It took climate change, fertile river valleys, domestication of crops and animals so that the hunter-gatherers became sedentary farmers.
Explanation:
Initially, all humans were hunter-gatherers. This was due to multiple reasons, with one the biggest one probably being the climate which was not enabling good conditions for the hunter-gatherers to transform their lifestyle. All other conditions needed were stopped because of the climate conditions, so humans had to do what they could to survive in those conditions.
About 10 years ago though the bad climate conditions ended, or rather the Ice Age ended. This resulted in a much warmer climate, which in turn created much more water bodies like rivers and lakes, much more vegetation, and they contributed to the creation of much more fertile soil.
With these conditions in place, the humans quickly saw that there is huge potential in some plants and animals, so they started to farm them, select the ones with the best characteristics, and gradually producing enough food for themselves. With the food problem solved, humans didn't have the need to wonder around all the time, so they started abandoning the hunter-gatherer lifestyle and started settling in one place.