When an individual engages in a behavior that the brain perceives as beneficial to survival (due to thousands of years of evolution and basic instinct), it produces a chemical signal called dopamine. Dopamine is the chemical that causes feelings of pleasure and happiness. The brain uses it as a reward system to reinforce certain behaviors. For example, the brain perceives sex as important for procreation. So it produces high levels of dopamine during and after sex in order to reinforce that it’s a good, useful action. And to encourage the individual to engage in that same behavior again. In comparison, drugs cause the brain to flood with dopamine and trick it into believing that drugs are necessary and important for human survival. Over time, the brain loses its ability to produce its own dopamine and depends on substances to create it. This is how addiction happens.
Like sex and dopamine, sugar and dopamine are also heavily linked. When an individual eats sugar, the brain produces huge surges of dopamine. This is similar to the way the brain reacts to the ingestion of substances like heroin and cocaine or any opioid (including milk and cheese which are opioid derivatives from the casomorphin).
While sex in the correct context creates large amounts of dopamine with the positive reward of procreation. Sugar creates similar levels of dopamine, but leaves your body with chronic issues such as cognitive impairment, excess glucose leading to diabetes, atherosclerosis (heart disease), myocardial infarction (heart attack) and cancers through the increased production of free radicals.