Part of the problem with issues like this is that we were not there, so we have no idea how it was said. Tone of voice, body language, overall context. And hearing the story on the internet makes it worse because it is natural to “hear” it based on our own personalities, inclinations, moods, whatever. I read this and thought what the OP said was not even close to being a big deal. We joked around like that all the time in band, on our hockey team, etc. With the teacher or coach there. Certainly in sports you are encouraged to think you are the best at your position. That is part of excelling.
So I think it is very hard to know if the joke, no matter the intent, truly did not come out the way it was meant, or if this teacher is a little bit “off”. If it is the latter, I would think the principal would know it and, if you present yourself calmly and make it clear what your intent was, then you should be fine. And while perhaps you don’t owe him an apology, sometimes in life when someone has some amount of power over you, it can be better to do the “non-apology” apology. Like “I am sorry if you took my remark as being arrogant. It isn’t at all what I intended, but I will certainly keep it in mind in the future that it can be taken that way”. If you do this in front of the principal, that would I think go a long way in your favor.