Because being a doctor requires a rarer skillset than being a firefighter or policeman.
However with the technology we have, things can easily be done by nurses and other less trained staff that currently require (by law) to have a doctor do.
An extremely high skill position like a heart surgeon is pretty necessary for a lot of people. I'm not sure why you'd think highly skilled people should not be compensated well.