To begin with, sensei 先生 isn't just a noun. It's a noun and a honorific, it's a title, a suffix that goes after names of people. Which means you can use the same word in two different ways:
- watashi no sensei wa Tanaka-san 私の先生は田中さん
My teacher is Tanaka
(here, sensei is a noun, the san honorific is used)
- Tanaka-sensei ga oshiete kureta koto 田中先生が教えてくれたこと
A thing Tanaka taught [me].
(here, sensei is a honorific)
There's little secret about how a noun works. A noun is a noun, a name for a thing, so let's ignore that one for a while. Instead, let's focus on the strange workings of honorifics.
As you could see in the example phrases, honorifics, like sensei, aren't always translated to English. This is because they work as personal titles, like saying Mister Tanaka (or Mr. Tanaka) or saying Professor Tanaka (or Prof. Tanaka). Something like that.
If Tanaka was a "master," shishou 師匠, his honorific title would be Tanaka-shishou 田中師匠 and it would be translated to English as "Master Tanaka." However, we do not use a title for "teacher" in English the way we do with "master." We don't say Teacher Tanaka all the time or Tc. Tanaka or whatever, so the sensei suffix doesn't get translated.
The closest title we have would be "professor," but in English it's aimed at university teachers which isn't the same as sensei in Japanese which may be an elementary school teacher for example. In fact, Tanaka-hakase 田中博士 would be closer to "Professor Tanaka" because hakase 博士 is a title for a doctorate / Ph.D.
(Senpai and Kouhai are other two nouns / honorifics often found in anime)
Kanji of Sensei
The kanji of the word sensei are curious because they have literally nothing to do with education. Most words related to school use kanji with meanings related to school. Like 教 meaning "teaching,", 育 meaning "growing up", or even 学 meaning "science" or "study." The word sensei alone has unrelated kanji.
This happens because the kanji of sensei, 先 and 生, mean "previous" and "life" respectively. Quite literally, a teacher is (usually) somebody who has lived before you. You don't see (outside of anime) high-school students being taught by kindergarten children. The teacher has to be somebody older, who has lived and learned before you.
The phrase saki ni umareta hito 先に生まれた人 shows it perfectly: "a person who was born earlier." Note the words saki 先, "earlier," and umareta 生まれた, "born," use the same kanji as sensei 先生, although the readings are different. (see kun'yomi and on'yomi readings of kanji)
Other Types of Sensei
Although most of the time a sensei is going to be a teacher or someone's teacher, that isn't necessarily always true.
A sensei may also be a master of an art who doesn't actually teach it. The most common and famous case of this in manga and anime happens with mangaka 漫画家, "manga artists," who are often called with the sensei honorofic despite not being teachers at all.
In the manga and anime Bakuman バクマン, for example, Ashirogi Mutou 亜城木 夢叶 is the pen name used by the two main characters on the manga they author. It is not even a real name, it's just a pseudonym. Even so, they are still called Ashirogi-sensei 亜城木先生 by other characters in the series because their skill and knowledge in the field has been deemed real.