Okay kiddo, back in the olden days, people who did something wrong were punished with things like public humiliation or even physical harm. But then, in the late 1700s, a new idea came about: instead of just punishing people, what if we tried to reform them and make them better?
So, they created a system where people who broke the law were sent to special buildings called prisons, where they would stay for a certain amount of time depending on their crime. The early prisons were pretty harsh and didn't focus much on making the prisoners better people.
As time went on, people realized that the harsh prisons weren't working very well. More and more people were being sent to prison, but they weren't really being helped or changed. So, in the mid 1800s, a new type of prison called a "penitentiary" was created.
This penitentiary was different from the old prisons because it was designed to focus on rehabilitation and changing the behavior of the prisoners. Prisoners were given work to do so they could learn useful skills, and they were encouraged to follow rules and behave well.
Over time, different types of prisons developed. Some were for men and some were for women. Some were for people who committed more serious crimes, and others were for people who committed smaller crimes.
Nowadays, prisons are still used as a punishment for breaking the law, but they also have programs and resources to help prisoners learn and grow as people so that when they leave prison, they have a better chance of succeeding in life and not committing more crimes.