Cocaine is a stimulant that increases concentrations of the neurotransmitter dopamine, which helps stimulate neural reactions in the limbic system, the part of the brain responsible for emotional responses and vivid memories (and, ultimately, cocaine addiction).
Normally, the cells that manufacture dopamine can also extract it when supplies are plentiful. This allows the brain to properly regulate the intensity of its reactions.
But cocaine interferes with this reabsorption process, allowing dopamine to accumulate until it causes overstimulation in the nucleus accumbens, the part of the limbic system that produces the euphoria and feelings of invincibility that make cocaine so intoxicating (figuratively and literally). Memories of the euphoria will remain vivid and powerful, and they can provoke an obsessive need to re-experience the rush that accompanied the initial use of the drug.
If cocaine use continues, cravings for the drug will grow, as the limbic system adjusts to elevated dopamine levels. Unfortunately, the structural and chemical changes in the brain that accompany continued cocaine use will eventually lead to addiction, and if cocaine use is curtailed withdrawal symptoms will then develop.