Because they're very upset about something like:
They're being bullied at school
Their parents are arguing
Someone they love has died
They just can't cope with all their problems and everyday stress like exams
It's a way for them to have some control over their own bodies when they feel they can't cope with anything else.
Some see it as a way of being able to feel when they feel empty about everything else.