A public execution is when people are punished for doing very bad things and instead of being punished in private or in a secret place, they are punished in front of a lot of people. This is done to let other people know that if they do bad things, they will also be punished and it hopefully stops them from doing bad things.
For example, long ago, if someone stole something or hurt someone, they might be punished in a public execution by being put in front of a lot of people and either beheaded or hanged. This was done so everyone could see how bad it was to do those things and they would be scared to do the same.
However, nowadays, public execution is not allowed in most countries because it’s seen as cruel and can be traumatizing to people who have to see it. It's important to remember that people should be punished for doing bad things, but it should be done in a way that is humane and private.