If you have been attending Church from a young age, this question has only one answer for you, and the answer is that David is the one who killed Goliath. In fact, this is the correct answer and there is no other answer.
But someone might bring to you a verse taken out of context from the Bible, challenge your faith and tell you that your answer is wrong, that you do not know your Bible, and that the Bible has “obvious contradictions”.
For some bible translations like the ESV, 2 Samuel 21:19 reads “and there was again war with the Philistines at Gob, and Elhanan the son of Jaare-oregim, the Bethlehemite, struck down Goliath the Gittite, the shaft of whose spear was like a weaver’s beam”
And here the question arises: Who killed Goliath the Gittite? Is it David or Elhanan the son of Jaare-oregim?
What is required of you when you encounter such scepticism, is to go immediately to your Bible to seek the truth of the matter, and not believe the words of the sceptic, for the Bible certainly bears the answer to the question.
In principle, you should read the whole chapter, and then go to other books of the Bible to help you find the explanation and the answer.
This chapter tells the story of wars with the Philistines during the reign of David (this is important information that we will return to later); but the story of these wars was also mentioned in another book of the Bible, which is 1 Chronicles. 1 Chronicles 20:5 reads “And there was again war with the Philistines, and Elhanan the son of Jair struck down Lahmi the brother of Goliath the Gittite, the shaft of whose spear was like a weaver’s beam”
Did you notice the difference? Put simply, Elhanan killed Lahmi, the brother of Goliath.
So why did the same writer mention in another book that Elhanan killed Goliath? Here the commentators say that Lahmi had the characteristics of his brother Goliath in terms of physical strength, body shape and height, to the extent that he could carry a spear the size of the weavers’ beam, and that is why Lahmi was nicknamed after his slain brother Goliath, and that is why the writer mentioned in 2 Samuel the common nickname among people, and he made it clear in the Book of Chronicles that Lahmi is the brother of Goliath.
The story takes place around the days of King David’s rule, as mentioned earlier, and in this period David’s age was over 60 years old, while the story of David’s killing of Goliath occurred during the reign of Saul, when David was a young boy probably less than 20 years old.
This information points to an important fact, that Goliath the Younger (Lahmi) was killed more than forty years after the killing of Goliath, the older brother. That is, he was a child when David killed his older brother, and therefore when he grew up and looked similar to his brother in size and shape, people called him Goliath.
So, there is no contradiction in the Bible, as it is a single unit that cannot be divided, and it is not correct to take a verse out of its context and build a story around it to try to prove the existence of a contradiction. The writer of the first and second books of Samuel is the same as the writer of 1 Chronicles, in the first story he mentions the nickname of Lahmi, and he mentions the story again, but by clarifying the name of the person with the nickname.
This always calls us to read the Bible more deeply, and to relate the events to each other, to be able to respond to those who question the authenticity of the divine revelation.