The claimed reasons for subsidies in the United States relate to the twin issues of good and bad harvests.
In a year of a bad harvest, a farm doesn't produce enough food for sale to buy other things (mortgage, taxes, electricity, foods they don't grow, seeds, gasoline for planting, fertilizing, and harvesting next year's crops).
In a year of good harvests, too much food is produced and prices fall. If prices fall by more than the harvest increases, this means that the farm still doesn't produce enough money for other things. Worse, the incentives force the farmers to be even more aggressive about producing more crops. More crops make that farmer's situation better, but in aggregate, they make all the farmers worse off. So the government has systems in place to buy up excess harvests in good years and support farmers in bad years.
At its worst, during the Great Depression the government created artificial scarcity by paying farmers not to plant crops. My great grandfather used that program to fund his retirement. That program fell out of favor, but the stabilization programs continue.
We can run into some confusion about this. Some farms are profitable enough that with proper management they can save up enough to survive good and bad years. Another issue is that under the system farms behave differently.
When my great grandfather farmed, he had a vegetable garden for family consumption. He raised cows. Some produced milk, for family consumption. Some were slaughtered for family consumption. But the bulk of them were for sale. He also had grain fields for family consumption and for his cows. He probably had trees that he could cut for firewood.
Modern farms tend to have just one product. This better fits the subsidy system. Wheat or corn or beef or whatever. They don't have the same ability to eat their own crops exclusively and trade only for luxuries. They may eat their own immediate product but they add to it by purchasing other products from the store.
Another challenge is that farmers may be nominally rich by many statistics. For example, they own tens or hundreds of acres which have several buildings upon them. There is high value in their product. Even a small farm may have tens of thousands of dollars of crops to harvest, if not hundreds of thousands. But their expenses are high. They need to retain some of their product so as to produce more next year (seed or breeding stock). If they raise animals, they have to feed them year round. They have to put fuel in their tractors. They have to repair their machines or pay someone else to fix them.
The problem is that their expenses may exceed their revenues. But a farmer doesn't have the same opportunities as their more urban cousins to collect welfare in that situation. They have too much apparent wealth to get income support. If a farmer who is already on the edge faces a few bad years in a row, they may not be able to catch up even when their situation improves. They may use up too much of their capital.
In addition, big farmers have more political clout to get favorable treatment than do small farmers. So programs that are designed to help family farms are also used by large farms. After all, they produce the same product, so government purchases in abundant years have to help both.
All this said, it is not definite that farming as an industry requires subsidy. The system started in the Great Depression when the banking collapse spread to the farms, as banks would foreclose on farms. To avoid that, farmers would desperately try to sell as much as they could. But prices were falling and people couldn't pay the same prices as prior to the Great Depression. Meanwhile, the mortgages stayed the same.
Once the system was in place, farms adapted to it. Single crops rather than a mix for personal use and resale. The result was that farms became more dependent on the system. Moving away from the current system might be difficult, but it is not necessarily impossible. Some farms have already started doing this. Organic farms often have more of the mixed crops used by traditional farms. But they also have the advantage of being a luxury.