I think this is a fear many parents have. I have certainly felt it. I remember when one of my kids hat been pretty mean to his best friend at pre-school. Scratching him up badly. I was horrified. Fortunatetly for us these kinds of incidents tended to be one-off as they where actually friends.
For me it helped that that the parents of his friend took it very well. I made sure tell the employees at the pre-school that I wanted to be informed about every case where he did anything like this.
This is many years ago now, but I remember not expressing anger towards my son but profound dissapointment. We had a longer conversation where I asked him how he thought it was for his friend and how he would have thought if somebody had done that to him.
Ultimately in our case it was primarily in issue of bad self control and lack of control with his anger and not a clear malicious intent. We have since worked a lot on improving that.
I don't want to give the impression that I have all the answers. Nothing is more annoying that people telling you they have all the answers about how to raise your child. Instead I think a good principle is a to be a student and observer of your own child.
Every child is different and figuring out how to best get them on the right track often means some experimentation, followed up with observation to better understand him/her and what works. It is quite difficult e.g. I find that both my sons respond very differently to the same methods. So you got to tailor child raising to each child.
But there are a couple of principles I feel are quite universally applicable:
1. Making sure your child is honest and tells the truth.
2. Understand their motivations and drives.
Truth is very important because if you don't know what happened and you don't know what truely motivated your child, then finding a remedy becomes very difficult.
This is where I feel getting really angry about wrongdoing can backfire badly. I have made a point out of rewarding honesty with my kids. Even if they have done something bad I have avoided scolding them and instead complemented them on being honest. I have of course explained carefully why their behavior was bad.
I feel I have seen such a consistent pattern over the years that children with very strict parents often end up lying frequently. It is a defense mechanism. They are so afraid of punishment that they get into the habit of lying and coverups.
And if they don't lie, they will often be black-boxes. You simply don't know very much about what they are thinkin or feeling. They keep things hidden to avoid that it gets used against them.
Thus at least initially I would be careful with punishment and scolding and reward that your son tells you the truth and is open about what he does to other kids. It is tempting to put him in his place right away, but then you risk not being fully informed about his behavior.
One can try positive reinformcement intially. Complement him each time he is doing something extra to be kind, and if he isn't remark to him when observing other children being kind of amazing they are. The point is to get him to see kind behavior to be a desirable trait.
At least you take this serious which I think bodes well for your son. I remember when I grew up in the 80s, the neigborhood had a pretty bad bully. His mother would always make up excuses on his behalf and trivialize all the bad stuff he did. He would just get worse as the years progressed without the mother taking it serious. Eventually he stepped over a boundary and ended up in prison.
But that you write this story tells me you are a caring parent who will eventually figure out a way to get your son the right track. Just keep talking to him, praise kind behavior when it is observed, express disappointment when he is mean. Try to get him to empatize with those he hurts.
At 5 years old I think children are still a bit too young the really have good idea of what they are doing.