Fewer sources support the first one, but today it is considered more likely.
The second one can be found in Fitjaannáll, probably written around 1670 (which is also the source of the story about the 50 children), and as that annal is a pretty accurate one overall, people used to trust it, and I suspect that is the linage you will see in your 1857 book.
However, the dates have made people suspect it.
Hallgrímur Pétursson was born in 1614
Guðmundur Hallgrímsson was born around 1540
Sveinbjörn Þórðarson must have been born before 1406 or so, as he became a priest in 1433 - and a gap of 134 years between a person and his grandfather is just very unlikely.