校
isn't the character for "school", it's a character for "school". Here are some of the others: 塾
, 学
, 學
, 宗
, 斈
, 泮
, 黉
, 院
, 黌
, ...
Characters are not a neat logical mapping of one picture to one concept.
In fact characters are not even Japanese, as I'm sure you know.
Characters evolved over thousands of years in China. This means meanings changed, characters changed, new concepts were invented or discovered, characters were adapted, simplified, devised, etc. Probably over and over again..
The result was characters with multiple meanings and concepts with multiple characters, sometimes with subtle differences in nuance, other times just used in different regions or in different eras, etc.
Many compound words also evolved, made of two or more characters.
Then Japan borrowed the Chinese characters both as concepts and as pre-formed Chinese compound words, adapted to Japanese pronunciation, which is utterly different to Chinese pronunciation, of which there are many utterly different kinds.
Characters were adapted to Japanese words, new characters were invented in Japan, characters changed slightly in how they were written in Japan, new compounds were created of Japanese parts written in characters, and also of Chinese parts written in characters.
Meanings and pronunciations and concepts also shifted in the time since Japan acquired characters.
Then Japanese writing was standardized and simplified, with a smaller number of characters remaining common compared to the larger set used formerly.
One of the results of this long slow natural process was the two characters you've noticed which have among their several meanings at least one meaning that is vaguely similar, with one being used in some rather arbitrary but now standard ways, and the other used in some other rather arbitrary but now standard ways.
You can expect this with the majority of the words in all languages of the world. And you can also expect it for the majority of characters or hieroglyphs, in languages that use such symbols as part of their writing systems.