Q:

Why do the best of doctors go to Gehinnom according to the Maharsha?

Says the final Mishnah in Kiddushin 82a:

טוב שברופאים לגיהנם
The best of doctors go to Gehinnom

If your name is followed by MD, you may leave now. 
The Maharsha is puzzled by why this should be the case:

יש לפרש טוב שברופאים דהיינו שמחזיק עצמו לטוב ולמומחה שברופאים שאין כמוהו וסומך ביותר על המחאתו מתוך גאוותו ולפעמים הוא טועה בטבע זה החולה וממית את החולה ברפואותיו בדבר שמזיק לחולה זה אבל יש לו לישא וליתן עם שאר הרופאים כיון שהוא סכנת נפשות: 
There is to explain that “the best of doctors” refers to those who hold themselves in such high regard and expertise of the doctors that there are none like him, and he relies too much on his own experience because of his arrogance. Sometimes he will make a mistake in the natural way of things and will kill a sick person by trying to heal him with something bad for him. Rather, he should consult with other doctors regarding things that could lead to death. 

This seems a little strange to me: At best, the doctor can only be faulted for accidentally killing a person. It’s not like he intended to kill the patient. Why should that outweigh all the (presumably) many more lives that he’s saved? 

A:

I am reminded of an insight I heard from R' Aharon Lichtenstein zt"l.
Shaul was assigned the job of killing all of the tribe of Amaleiq. He led a war that almost did it; but he left one person -- Agag, their king -- alive. Shemuel told him that as punishment, Shaul would lose the throne; he would be a one-king "dynasty".
Rav Lichtenstein taught that it was not saving Agag that was the great sin that carried such a punishment. Rather, by not killing Agag, Shaul proved that killing everyone else wasn't to fulfill the mitzvah. If he wasn't following G-d's command to kill EVERYONE, then killing the rest of Amaleiq was simply genocide.
I read the Maharsha you ask about similarly. Notice the Maharsha mentions two things: arrogance, and the inevitable mistake. If a doctor acted purely to help others, then he wouldn't be considered guilty for any mistakes. To the extent that a doctor acts for the sake of their own ego, the actions in which they erred also had that element of for their own ego. And they are guilty to whatever extent they harmed someone else out of a pursuit of self aggrandizement. Even if it's also along with other, purer, motives, that element of petty motive leading to harm needs purging in gehennom.

