This might seem odd, but in Ancient Greece, education wasn't something you went to a building for. It was often a form of leisure activity for the wealthy, conducted by philosophers or teachers in public spaces or private homes.
Over time, the meaning of "schole" shifted, evolving to include the concept of "leisure dedicated to learning". This eventually led to the modern use of the word "school" to refer to a place of formal education.