Consider the following sentences:
1- I was driving along the highway but I stopped to smoke a ciggie.
2- I've stopped somoking. I'll never smoke again.
In 1. stop + to do sth refers to stopping doing something in order to do something else.
In 2. stop + doing sth refers to quitting an activity.
Student or Learner