Answer and explanation:
The word vanity refers to the (bad) quality of having too much pride and confidence, especially in one's own achievements or appearance. When we say someone is vain - or has vanity, for that matter -, we mean to say they think highly of themselves, but we probably don't agree with their opinion.
In the epic poem "Beowulf", Unferth is a warrior who insults and is jealous of Beowulf. In this excerpt, he mentions one of Beowulf's feats - swimming against Breca in the open sea - but in a critical tone. In the story, he actually claims that Beowulf lost the contest. By using the word vanity, and adding the information "just to show you could win", Unferth seems to want to diminish Beowulf's qualities. He basically states, as an underlying meaning in his question, that Beowulf is full of himself. The reason for his jealousy is most likely the fact that Beowulf has been "invited" to defeat the monster Grendel, something that Unferth has failed to do.