Doctors generally want the best outcome for their patients, but are heavily optimized for what they see most often.
If 90% of your patients come in sneezing and it's a flu for 30 years, then you generally give them advice for handling a flu and it works most of the time. But that also means you have a tenth of the experience handling the edge cases, at best.
Confounding variables make this a lot worse, like people having multiple symptoms, or not telling the doctor things because they felt dismissed before, or that they stopped seeing them because they gave actively harmful advice.
Having a lot of experience with doctors is what has convinced me medical training needs reform. Doctors actively ignore patients telling them objective factual reasons their advice is incorrect or harmful, and treat you as a hypochondriac for arguing.
I have stopped seeing a number of doctors over the years after they looked at my medical history and said "let's try X again", and when asked why, "just to see", when I have already tried X and two or three other medications in the same family as X, in the history (often from their own larger department, not something I provided), in the last 2 years.
I have stopped seeing doctors over me telling them that raising the dose of a medication made me much worse and having them then cut the visit short by leaving the office, saying they were late for something else, and telling me they were writing a script for double the dose as they left (and no, the drug in question did not have strange dose-response relationships like, say, Seroquel).
I have stopped seeing doctors over them insisting I just had a cold when I told them I was too exhausted to reliably walk two blocks to their office without an escort, every day for a week, not sleeping, and unable to keep any food down, without changing their mind, when I turned out to have pneumonia.
None of them were trying to be harmful.