I think there were two fears. One is that you might want to stay in your house for a long time without having to go and get groceries. Either because you are quarantining, or because you're very afraid of catching a dangerous virus if you go out. Having plenty of food in the house could be the difference between having to take a risk and avoiding that risk.
Secondly I think a lot of people worried, rationally or not, about a 'breakdown of society'. If there is enough death and disease then maybe everything stops working. People don't go to work, transport and food production break down, there is looting and widespread lawlessness, and so on. Perhaps it's very hard to get food, or impossible to get some foods, or some form of government rationing starts. In that case having a stockpile could be very valuable.
Secondly I think a lot of people worried, rationally or not, about a 'breakdown of society'. If there is enough death and disease then maybe everything stops working. People don't go to work, transport and food production break down, there is looting and widespread lawlessness, and so on. Perhaps it's very hard to get food, or impossible to get some foods, or some form of government rationing starts. In that case having a stockpile could be very valuable.