Great question.
In the second, it's an adverb.
As for the first, it seems to me that "fastest" is not an adverb there, and it does not modify "runs". Instead, I think "fastest" is an adjective and fits into "the fastest [one] in the class" which acts like a noun, as in the sentence
"He is the fastest in the class".
I would interpret the first by inserting two missing but understood words:
He runs [as] the fastest [one] in the class.
The article "The" requires a noun, does it not? If you stick "the" in front of an adjective, like
"the largest" or "the loudest" or "the fastest"
something always seems to be missing:
"the largest WHAT", "the loudest WHAT", "the fastest WHAT".
If the WHAT is not stated, it is implied.