How can someone get in trouble for self defense?

It’s absolutely ridiculous. Nobody should ever be punished for self defense. Punishing a person for using self defense needs to be a capital crime. If I had to hurt a person to defend myself, I’ll do it whether it’s legal by law or not.
Like in school, if I was a kid in school, if someone attacked me, I would defend myself even if I’d get expelled from the school. I’d rather defend myself and get expelled from the school than end up in the hospital.
How can someone get in trouble for self defense?
Post Opinion