Habit and addiction don’t necessarily work the same way.
Habit is a strategy we have for conserving mental energy. If we’re doing something for the first time, we exert a whole lot of mental resources trying to understand what we need to do to get the result we want, monitoring whether things are turning out OK, dealing with unexpected outcomes, worrying about appearing incompetent, etc. It requires full and sustained attention. This can be a stressful experience, and causes the brain to burn lots of fuel. This is why we often feel apprehensive and overwhelmed when navigating new situations.
Animals evolve in ways that maximize efficient use of energy. The human brain is already one of the most energy-gobbling organs in the animal world. If our every action involved a decision about the best way of proceeding at every moment, so that we were constantly making it all up from scratch as we went along, we would be using massive amounts of fuel and would become mentally fatigued very quickly.
Habits are little scripts that avoid having to invent our actions anew all the time. Once we’ve been through a routine enough times to ingrain the actions into our muscle memory so that they no longer require thought, and we’re satisfied that the outcome is usually satisfactory and danger-free, then we’ll tend to just run that script by default every time. It’s now the easiest thing to do. When we’re confident that our scripts are reliable, then we feel relaxed and able to enjoy the overall experience, without having thinking get in the way. When I get out of bed on a weekday morning, I don’t have to think about what to do first, second and third, nor how to do any of it. I can almost just watch as my body runs its scripts, one after the other. That’s habit.
We may be vaguely aware that there’s probably a better way of doing this or that, but we know that changing would involve dedicating mental resources that we might prefer to spend elsewhere, and might make us feel more vulnerable for awhile. Changing routines usually makes us feel uncomfortable in various ways. We often just decide we’d rather not deal with all that.
As for addiction, the people above have already explained the dopamine connection well enough.