Is cutting yourself masochism?
It could be considered masochism, but that doesn’t really make a difference. It’s a way of dealing with intense, overwhelming emotions. For some reason, your brain isn’t very good at managing them in a healthy way, perhaps thanks to some crappy parents or childhood trauma. Regardless, it’s dangerous. You (or your friend) need to talk to someone about it – a therapist, school counselor, or really any nice adult you feel comfortable with.