Skhole in classical Greek means leisure and spare time, and by extension learned discussion and the group holding it, the usage visible in Plato and Aristotle. Latin borrowed schola, Old English took it as scol, and the modern institution inherited a word that began as the absence of obligation.
The usual telling adds a moral: school is what leisure became when leisure got organized. Some versions credit the Lyceum and Academy with the shift, though both were named for their grounds, a gymnasium grove and a hero's park, not for the concept.
Etymology-minded critics of compulsory education point at the word as evidence of inversion: a term for voluntary contemplation now names mandatory attendance. Whether that is a warning or a joke depends on who is talking.
If the word remembers that learning was once what you did when nobody could make you do anything, what exactly did we build?