It's not just american schools. All schools resemble prisons because all school systems around the world essentially adopted the american model which borrowed heavily from the prussian model.
All schools were compulsory indoctrination centers which buttressed the burgeoning nation-states.
https://en.wikipedia.org/wiki/Prussian_education_system
Modern education system, along with national media, government, etc are pillars of the nation-state. You can't have a nation-state without one nowadays.