Dopamine is a neurotransmitter that makes the reward system work. Dopamine makes us want things like food, social connection, sex and also escape from things like pain, bad smell etc. If dopamine level is high, you like that thing and if dopamine level is low you dislike that thing. Canabis, cocaine and many other drugs highjack the reward system and make it release dopamine. This is how the brain creates a connection between the action and the result. By releasing a lot of dopamine, strong pathways are created and the action, in this case using drugs, and the result, feeling pleasure, is connected. That is how addiction forms.

Porn is also known to highjack the reward system since it also makes the brain release dopamine because sex is one of the most important natural rewards. Humans reproduce by having sex, and reproduction is the ultimate goal for a living thing. So it is rewarded highly.