There are many different reasons.
1) Freshness of food. Likely the food you buy at the Farmers market was picked within 24 hrs. Certain nutrients are light and heat vulnerable and start to decay within a day or so. The 3-week old apple from Chile no longer has the vitamin C, folate or thiamin it started out with.
2) Local is defined as within 100 miles; so within a day to transport. Choosing local means choosing food that has a lower fossil fuel footprint to bring it to you. The apple from Chile was driven, flown and then trucked to the North American grocery store, spending thousands of calories in fossil fuel for the 50 or so calories that it actually provides to the eater.
3) Quality assurance. If you can visit a farm and it has an open and welcoming policy, you can see how they run their business with your own eyes. You can develop a relationship with your farmer and be reassured of the quality of the food you are buying.
4) Economics. A small local Farmer takes home 95% of what you pay them at the Farmers Market, vs 5-15% from the supermarket. Local farmers mostly source their supplies and equipment locally, almost 90% in one study, and create close to 3 times as many jobs per $1M in income. Local farmers spend their money locally too, perhaps even supporting your business. What goes around locally, comes back locally.
In Portland, the Farmers market is Saturdays in Deering Oaks Park and Monument Square from 7-1 until Nov 27th. Then it moves inside to the Girls School on Stevens Avenue near Walton st. for the winter on Saturday mornings only, 9-1.