In Full Metal Panic, why does Sousuke call Hayashimizu Atsunobu "Your Excellency"?
Hayashimizu's shall we say "extraordinary" tolerance for Sousuke's school shenanigans is a separate question, so I will abstain from that and focus on your primary issue:

The short answer is: it's a joke, based on Sousuke's inability to distinguish between the nature of life in the school environment and life in the dangerous geo-politico-military environment in which he's lived his entire life. Hayashimizu is introduced to him as the school's President. In real life, nobody is higher than a President (certainly not any "mere" Teachers!), and so he defers to him accordingly, as if he were the President of an actual country. "Your Excellency" is a formal way to address a President, or any Head of State. The humor comes from Sousuke's exaggerated politeness and formality whenever dealing with somebody who is in reality merely another student, with some extra after-hours responsibilities! 

(However, it should be noted that in the light novel, "Continuing on My Own", their conversations show that both have developed a very real and deep respect for the other, based on their history and knowledge of each other's personalities.)