Structurally and semantically, the first example you gave which is affirmative in structure, uses do as a "full" or "main" verb. The second example, on the other hand, uses "doesn't" as an "auxiliary" or "helping" verb.
Remember that the verb do can grammatically function as an auxiliary/helping and a main/fullverb. As an auxiliary we use do in negative sentences and questions.
The two grammatical functions of the verb do are clearly shown in your second example.
He doesn't do an exercise.
The first form of "do" which is "does" functions as auxiliary/helping verb and the second form "do" functions as the full/main verb. Worthy of mentioning too is that the verb "do" is an irregular verb.
Hope this helps.