You ask two questions:
Why is there extra text in the KJV of 1 John 5:7? [title question]
and
The KJV text is used to substantiate the trinity so what effect will the texts from the NIV and ESV have on that teaching?
I believe another answer attempts to address your title question. A common misconception is that the original KJV was translated from the so-called "Textus Receptus". What we call today the Textus Receptus was not actually compiled until 1881 by Frederick Scrivener, who in effect reverse-engineered the KJV to extract the underlying Greek text. The KJV translators probably consulted 7 different Greek texts:
- Five editions produced by Erasmus between 1516 and 1535
- A 1550 text edited by Stephanus
- A 1598 text edited by Beza
All of these came from disparate sources, but none probably dated to earlier than the 11th century. (There is a good discussion of the Textus Receptus here).
The primary Greek source for the NIV, ESV, and many other modern English translations is the eclectic text of Nestle-Aland (28th ed.). The text is called "eclectic" because, like the Textus Receptus, it was not the text that appeared in any one particular Bible. It is essentially a text produced by cutting and pasting from numerous manuscripts. The NA28 leans heavily on two texts that originated from Egypt: the Codex Sinaiticus, which had been preserved in the Eastern Orthodox monastery of St. Catherine's in the Sinai1, and the Codex Vaticanus, which, although preserved in the Vatican, seems to have a similar text type to that of the Sinaiticus ("Alexandrian") and may have been brought to Rome after the fall of Constantinople in 1453. Both these texts date to the early to mid-4th century.
Regarding 1 John 5:7-8a, a footnote in The Orthodox New Testament Praxapostolos (a translation of the Eastern Orthodox Patriarchal Text cited in another answer) explains:
These words are not found in any early Greek manuscript. Four of the eight existing manuscripts contain the passage in what appears to be a translation from a late recension of the Latin Vulgate. The four miniscules which contain the passage as a variant reading written in the margin as a later addition are as follows: Miniscules 88v.l (16th c.), 221v.l (10th c.), 429v.l. (16th c.), and 636v.l (16th c.). The remaining Miniscules are: 61 (16th c.), 629 (14th c.), 918 (16th c.), 2318 (18th c.)
Down to the thirteenth century, no Greek writer makes mention of this passage. Later it is cited by one Greek author, the 15th century Dominican monk and adherent of Thomas Acquinas, Manuel Calecas. The first to cite this phrase in Latin was the Spanish heresiarch Priscillian (4th c.) , and it appears in a considerable number of Latin manuscripts. It entered the printed versions of the Greek text when it was included as a translation from the Latin in the first printed Greek Bible edition (1514), by the publisher Cardinal Ximenes de Cisneros2. The Greek Lectionaries of the Apostolike Diakonia and Phos include it. The Constantinople Edition [PT], designating the phrase as an addition, has printed it in small type.
It is absent form the manuscripts of all ancient versions (Syriac, Coptic, Armenian, Ethiopic, Arabic, Slavonic), except the Latin. However, it is neither found in the Old Latin, nor quoted by St. Cyprian or Augustine, nor is it in the Vulgate issued by Blessed Jerome.
Regarding the second question,
The KJV text is used to substantiate the trinity so what effect will the texts from the NIV and ESV have on that teaching?
I would submit that theological truths are witnessed by Scripture as a coherent whole and very rarely, if ever, in a single isolated passage. The New Testament contains numerous expressions concerning the Triune God:
Matthew 28:19 (KJV)
Go ye therefore, and teach all nations, baptizing them in the name of the Father, and of the Son, and of the Holy Ghost
2 Corinthians 13:14
The grace of the Lord Jesus Christ, and the love of God, and the communion of the Holy Ghost, be with you all. Amen.
John 15:26
But when the Comforter is come, whom I will send unto you from the Father, even the Spirit of truth, which proceedeth from the Father, he shall testify of me
One might also consider that the dogma of the Trinity was affirmed by the Church before the closure of the New Testament canon. The Trinity was affirmed in the Creeds of the Nicene and Constantinople Councils (325 and 381, respectively), whereas affirmation of the New Testament canon by a local Church council would not take place until 397 (at Carthage), and by an Ecumenical council until 787.3
1. As a historical footnote, the current librarian of St. Catherine's is an Eastern Orthodox monk/convert from El Paso, Texas
2. Although Cardinal Ximenes printed his version before Erasmus, he was prevented from publishing his text before Erasmus due to delays in approval form the Vatican. Some attribute some of the apparent errors in Erasmus' earlier work to haste in trying to come out with his version before Cardinal Ximenes
3. For example, the early 5th century Codex Alexandrinus, one of the principal Greek texts underlying the NIV and ESV (via NA28), included two Epistles of Clement in the New Testament.