"I stopped smoking" means that you were smoking, but for some reason you stopped it. For example, "I stopped smoking when my mom entered my room."
Where as, "I stopped to smoke" means that you were going somewhere and stopped, so that you could smoke. For example, "I stopped to smoke on my way back home."