The dragon's hoard is cursed and
"the high-born chiefs who had buried the treasure
declared it until doomsday so accursed
that whoever robbed it would be guilty of wrong
and grimly punished for their transgression..." (3069-3072).
Beowulf can be excused for not knowing this - in fact, it seems none of the Geats know this - but he should have known that