It was once thought that agriculture (food production) was “invented” by some group at some discrete point in history. Now, however, we believe that agriculture evolved gradually rather than being invented at some specific time. The kinds of things that hunter-gatherers did naturally led to agriculture.
Let us think about the beginnings of plant domestication. Hunter-gatherers would have wandered about looking for grasses with large seeds or fruits with a lot of meat around their seeds. They would have picked the best of these and brought them back with them to their camps. As they did so, they would likely have dropped some of the seeds. They might have thrown away spoiled fruit. After eating the fruits, they would have excreted the seeds. What would have happened then is that fairly concentrated bunches of these plants would have sprouted around places where the people camped. These plants would have been somewhat superior to the average plants because they would have all come from “good” plants that the people had picked because of their quality.
Over the years, people would have noticed this. They might have done things to help those plants grow. They might have cleared other plants away. As they did these sorts of things, they would have been taking the first steps towards actually domesticating plants. Over time, they might have created large enough patches of the plants that it would have become useful for them to settle down in one place and start exploiting those resources rather than roaming the countryside looking for food.
In this way, food production would have come about in a very gradual and evolutionary way.