The other reason is that most doctors don’t stay up-to-date on developments in medicine (including those impacting fitness/diet) outside of their areas of specialisation.
So a generic doctor’s understanding of principles of fitness/diet may be way outdated – probably dating to when the syllabus was set for their time in med school.
It’s hard to ignore the doctor’s advice,
even if we strongly doubt it’s reasoning,
even if it’s on an area that’s not the doctor’s specialisation,
even if the doctor themself insists that they’re not up-to-date on the domain.
Better, do your research, go to a specialist for advice, and challenge their advice (even if to understand the reasoning) if it doesn’t match your research.