Beowulf begins with a brief biography, and the death and burial, of Scyld Scefing (also called "Shield Sheafson" in some translations). We don't learn much about Scyld, other than that he was a good king, victorious in battle, had a son, and was buried on a boat that was loaded with treasure and pushed out to sea.
Scyld is considered to be the same character as Skjolder, a legendary king who appears in multiple sources, of whom little is known and little is held in common between the different versions. He appears to be something of a template for high ancestry; Beowulf and other sagas culturally aligned with Northern Europe place great importance on genealogy, and claiming descent from a legendary king is akin to Romans claiming descent from Romulus - they may be well aware that it's just a story, but it's a better story than saying your ancestor was a farmer or a shepherd.
By establishing Hrothgar as a descendant of Scyld, the Beowulf poet may be intending to accomplish several things;
- starting the story with a familiar character to draw in the audience and set the tone
- establish the power and respect for Hrothgar's lineage
- elevate Beowulf's heroic character (i.e. Hroth is the descendant of this great legendary king, but even that wasn't enough to defeat Grendel - he needed someone even more powerful)