It looks like maybe it is a translation problem? Here is the verse in the KJV and it was David's brother, Elhanan, who slew Goliath's brother at another battle at Gob. No worries, whenever there is something that doesn't make sense to me I then know I just need to research into it more.
King James Bible
And there was again a battle in Gob with the Philistines, where Elhanan the son of Jaareoregim, a Bethlehemite, slew the brother of Goliath the Gittite, the staff of whose spear was like a weaver's beam.
King James Bible
And there was again a battle in Gob with the Philistines, where Elhanan the son of Jaareoregim, a Bethlehemite, slew the brother of Goliath the Gittite, the staff of whose spear was like a weaver's beam.