Both words can be used to refer to any bodily discomfort that an individual may feel. Of the two, ‘pain’ is the more general term. The pain that you feel in some part of the body may be intense, or it may be mild; similarly, its duration could be either long or short. If you hit your thumb with a hammer, the pain could last for a few seconds, or for several days.
Usually, ‘pain’ implies something that comes on suddenly. When you bump into the wall, you feel ‘pain’ and not ‘ache’. The pain that you feel could be local — over a small area — or it could be widespread.
Ache, on the other hand, is usually associated with a particular part of the body; we often talk of a toothache, headache and stomachache. When we get any of these aches, they usually last for some time. They don’t disappear in a matter of minutes.
An ache, therefore, is usually long lasting. Another difference is that the discomfort that one experiences is not as intense as ‘pain’; some dictionaries define ‘ache’ as ‘dull pain’.