Beowulf's origin is unknown. That said, it has changed over the many generations it has been a part of the world. Originally, the epic tale was told by scops (singers who told stories to entertain), given that it came to exist far before the written world was universalized. The epic, now, is told from a third-person omniscient point-of-view with a Christian perspective.
As for the purpose of the epic tale, one could only suggest the reasons behind its creation. Some have stated that the purpose of the tale was to elevate the characters of the Anglo-Saxon culture to be ones which the society deemed the most important. Therefore, by naming specific characteristics as important, other people (hearing the tale) would strive to be more like the characters in the tale, mirroring the desired behaviors and beliefs.
Essentially, given the multiple unknowns about the text, one can only assume that the tale functions very similarly to the myth tales of every culture. Myth tales function to offer readers insight into the importance of morality, the origin of specific thoughts and ideals, and the elevation of specific characterizations. Outside of assumptions, one can only justify Beowulf's purpose by interpreting the text, making a hypothesis about its nature, and supporting said hypothesis with textual evidence.
When Beowulf was first transcribed into Old English by Anglo-Saxon monks, England was not yet the unified country we know today. One of the factors that eventually brought about that unification was the spread of Christianity, which was still in progress at the time of Beowulf's creation.
Because Christianity was still relatively young, we see a mixture of pagan mythology (specifically the god Woden) and Christianity in the story. Scholars think that it is possible that the Christian references were not part of the original epic, but were instead added by the Christian monks that wrote the poem down for the first time. This seems like a good possibility, especially when the reader encounters passages like this:
Beware, those who are thrust into danger,
Clutched at by trouble, yet can carry no solace
In their hearts, cannot hope to be better! Hail
To those who will rise to God, drop off
Their dead bodies, and seek our Father's peace!
This passage comes at the end of the section of the poem that first describes Grendel's attacks on Herot. It is easy to imagine a monk copying the poem and then tacking on this monotheistic reference to the Christian God.
In this sense, we can think of the purpose of Beowulf as way to bolster the development of Christian faith and thought in a region of the world that was still making the transition from polytheistic mythology.