Well, start with the Wikipedia page.
On fertile soil, a tall coconut palm tree can yield up to 75 fruits per year, but more often yields less than 30, mainly due to poor cultural practices
The same page lists the nutritional value as 354 kcalories per 100 gram serving.
And finding the weight of the edible fruit part alone, the USDA says that one medium coconut has 397 grams of meat.
So one tree gives 354 × 3.97 × 30 ≈ 42,000 kcal/year.
Of all the nutrients needed, I expect lack of calories will kill someone the fastest. You can repeat the analysis with other requirements and timescales for the deficiency to become debilitating, with the information “food label” on that page.
If each adult male needs 1,500 kcal per day, that comes to 13 trees. But that’s for a sedentary white-collar worker; it’s suggested that harvesting will take some effort and the castaway may need to be more active in general. With a ration of 2,000 kcal per day, 18 trees will be enough. That assumes production is continuous or food can be stored, and that the wild coconut is similar to a “medium” cultivated coconut. Add a few extra to be sure. You can adjust that based on the activity level you need for the story.
We assume the low value indicated for yield at least for the first year. If he knows what he’s doing and “farms” them then yield can go up. But if there is nothing else to eat there’s nothing to use as fertilizer either, so it might be slim pickings.