Main reasons could be due to insecurity. Depression and/or anxiety is also a possibility as well. A way to help them and discourage the habit is to simply talk to them; Find out what's going on in their life or what they're going through.
It also could be ADHD - hyperactivity & short attention span - which also leads to many problems.
Hope this helps!