Sometimes people self medicate with drugs and /or alcohol to relieve or try and escape emotional pain-then they get addicted.
Sometimes they have an a pre-existing brain chemical imbalance that can be corrected with anti-depressants.
sometimes people have had traumatic lives and this has caused them emotional pain and they use drugs to escape feelings.
my exabf was sexually abused as a kid and there was pretty bad violence in his home growing up. sometimes I wonder if this is part of the reason he started using-but he continues to use mostly because he is addicted now, but I think the emotional pain has something to do with it as well.
I have noticed that long term cocaine users often exibit extreme paranoia-which sometimes lingers even after they have become sober.