Gary gives an explanation (sort of) for Diglett in the episode "Dig That Diglett".

Of course, that was still when he had his harem of cheerleaders and was a major jerkass. He may have been the proverbial "Know-Nothing-Know-It-All" back then.