The reasons why addiction occurs are highly complicated, and still being investigated by scientists! What we do know is that addiction heavily relies on the neurotransmitter dopamine, a chemical you may have heard of that is known to cause feelings of happiness and relaxation in humans. The final effect of the majority of addictive drugs is the release of dopamine in the brain.
Scientists have hypothesized that abusing these drugs can cause physical changes in the brain in the form of creating new "receptors", molecular places where signals can be received. This creates dependence because your brain gets used to receiving signals like dopamine, which becomes part of the chemical balance in your brain. Throwing off this balance leads to many harmful effects, making it difficult to stop taking the drugs in question.
It is important to note that while drug and game addiction both involve becoming dependent on "happy" chemicals like dopamine, they are different kinds of addiction. For instance, the withdrawal from drug addiction, experienced after you stop taking the drug, can be much more severe than withdrawal from gaming in some cases even fatal. This is because gaming relies more on psychological addiction, whereas drug addiction can strongly effect the physical structure of the brain. However, becoming dependent on the motivation and rewards experienced during gaming, similar to gambling, can produce a release of dopamine that can lead to a reduction in quality of life due to dependence. Of course, there is still no universally accepted theory of addiction; maybe you could be the one to find it!
If you're really interested, check out these helpful papers: