Addictions can develop from something totally innocent such as experimentation, recreational and sporadic drug use but can also develop as a person does their best to cover up previous trauma.
There’s a big difference however between an addiction and a habit. An addiction is defined as a habit that’s become out of control however an addiction will typically have a very bad effect on the users life.
What truly separates addiction from habit however is the psychological link. People who exercise a certain habit do so for fun or relaxation etc and can stop at any time.
An addiction however will see an overwhelming need and desire, as well as usually, an inability to stop without correct addiction treatment and help. To cut it short, a habit can be stopped but an addiction cannot.