Yes, there is a name for it:
self-harm.
From Wikipedia:
"Self-harm (SH) or deliberate self-harm (DSH) includes self-injury (SI) and self-poisoning and is defined as the intentional, direct injuring of body tissue most often done without suicidal intentions. These terms are used in the more recent literature in an attempt to reach a more neutral terminology. The older literature, especially that which predates the Diagnostic and Statistical Manual of Mental Disorders (DSM-IV-TR), almost exclusively refers to self-mutilation. The term is synonymous with "self-injury".[1][2][3] The most common form of self-harm is skin-cutting but self-harm also covers a wide range of behaviors including, but not limited to, burning, scratching, banging or hitting body parts, interfering with wound healing, hair-pulling (trichotillomania) and the ingestion of toxic substances or objects."