Imagine you are in a class with some other children. Now, one day, one of the children in your class does something wrong, like talking when the teacher is teaching or throwing something. Now, instead of punishing just that one child who did something wrong, the teacher punishes everyone in the class, including you, even though you did nothing wrong. This is called collective punishment.
It's like if you and your friends were playing together and one of you broke a rule or did something bad, instead of the adult explaining to the person who broke the rule what they did wrong or why it was bad, the adult punished everyone, even those who were following the rules.
Collective punishment is not fair because it punishes all people, even those who did nothing wrong. It doesn't help the person who did something wrong to know what they did wrong or how to make it better, it just makes people upset and frustrated who didn't do anything wrong.