I will check this up tonight, and get back to you about this. I would say that the KJV is correct in this passage because NIV follows a thought by thought translation, not word for word.
Hey I just found this on NET Bible - http://www.bible.org/netbible/index.htm
34sn The Hebrew text as it stands reads, “Elhanan son of Jaare-Oregim the Bethlehemite killed Goliath the Gittite.” Who killed Goliath the Gittite? According to 1 Sam 17:4-58 it was David who killed Goliath, but according to the MT of 2 Sam 21:19 it was Elhanan who killed him. Many scholars believe that the two passages are hopelessly at variance with one another. Others have proposed various solutions to the difficulty, such as identifying David with Elhanan or positing the existence of two Goliaths. But in all likelihood the problem is the result of difficulties in the textual transmission of the Samuel passage; in fact, from a text-critical point of view the books of Samuel are the most poorly preserved of all the books of the Hebrew Bible. The parallel passage in 1 Chr 20:5 reads, “Elhanan son of Jair killed Lahmi the brother of Goliath.” Both versions are textually corrupt. The Chronicles text has misread “Bethlehemite” (בֵּית הַלַּחְמִי, bet hallakhmi) as the accusative sign followed by a proper name אֶת לַחְמִי (’et lakhmi). (See the note at 1 Chr 20:5.) The Samuel text misread the word for “brother” (אַח, ’akh) as the accusative sign (אֵת, ’et), thereby giving the impression that Elhanan, not David, killed Goliath. Thus in all probability the original text read, “Elhanan son of Jair the Bethlehemite killed the brother of Goliath.”