There are three parts to a smoking habit. Two of the parts are mental/emotional, and one part is physical.
Part A: People smoke because their mind was programmed to receive relaxation and pleasure when something is put into their mouth.
It all started when you were an infant. You got cranky; your mother put a bottle into your mouth. You got distracted by the bottle, became more relaxed, and probably fell asleep.
Now, as an adult, when you feel tense or nervous, you put cigarettes into your mouth for relaxation and pleasure.