Here's why:
* It modifies a verb: It tells us *when* something happens. For example: "We ate dinner, and *afterwards* we watched a movie."
* It can modify an adjective or another adverb: "He was *afterwards* much more confident."
Let me know if you have any other words you'd like to identify the part of speech for!