Heroes in fiction do morally questionable things all the time, and what makes one character a hero and another a villain can often depend on details like the circumstances, the scale, or just how the narrative frames it.
For example, Batman is a vigilante. That's illegal, and ethically questionable because he's placed himself above the law, and raises questions like "who does Batman answer to?". He violently assaults criminals without oversight, he does detective work without a warrant, he drives an unregistered vehicle through the streets without registration or insurance, he carries potentially deadly weapons... but the narrative usually frames Batman as a good guy, because in Batman stories, Batman is always framed as being a grim necessity in Gotham.
If your protagonist never does anything bad or even questionable that gets them into trouble, they often come across kind of passive, like they're just this cinnamon bun who just exists and the baddies just keep turning up and targeting them for some reason. This kind of protagonist can work if they keep being put into situations where choosing to take the moral high ground puts them into a harder, more troublesome situation (for example, the character who chooses not to let their boss do something illegal and gets fired for it, or the hero who refuses to kill a baddie having to face them again later). But often, if your character is out there in the world trying to do stuff... sooner or later they're going to end up in a position where they have to choose to do something morally or ethically wrong to achieve their goals, or they might end up succumbing to a personality flaw or a personal conflict. It's morally wrong to punch the bully who punches you every day (or at least, The Bible says so... You always have to consider that what's 'morally wrong' varies by culture and person!), but to a lot of the audience, it's going to feel totally justified, especially if reporting it to teachers hasn't stopped the bullying.