Not long after the founding of Christianity, the Christian faith spread throughout the Roman Empire. As Christianity developed, the 27 books of the New Testament were recopied and distributed, along with other books, written later, which claimed false apostolic authorship. Many of these false books were discovered in 1945 in Nag Hammadi, Egypt, and the collection became known as the Nag Hammadi library.
The Nag Hammadi Library: Origins

As Christianity spread, so did heretical views regarding the person and divinity of Jesus Christ and the nature of the Trinity. One of the more prominent areas of heretical beliefs was in Northern Egypt. While many of the writings of the heretics have been lost to time, a number of manuscripts of both Biblical and heretical writings have survived due to the climatic and geographic conditions of Northern Egypt. Among the findings was a significant collection of works discovered in 1945 that has come to be known as the Nag Hammadi library.
Among the Nag Hammadi library were works that were previously known only by vague mention, often condemnatory, from early Christian Church leaders. Most of the works were written after the New Testament period, and often pseudographical (the author claiming to be someone he was not), with the author claiming to be an Apostle such as Thomas, John, or Peter.
Prominent Books in the Library

The Gospel of Thomas, The Gospel of Philip, the Apocryphon of John, and the Gospel of Truth are probably the most well-known of the books found at Nag Hammadi. In all, over 50 texts were discovered within 13 leather-bound books called codices (plural of codex).
Why Aren’t There More Copies?

Gnosticism was generally condemned by the 4th century throughout Christianity, and found significant opposition from church fathers before then. Irenaeus of Lyons wrote Against Heresies in the late second century, focusing much against Gnosticism. Hippolytus of Rome specifically condemned the Gospel of Thomas around the same time period. By the fourth century, Christian orthodoxy had been established generally according to the Nicene Creed, which left little room for Gnostic thought. Athanasius of Alexandria, in his 39th Festal letter, lists out what he considered the Biblical canon, including the modern listing of the 27 books of the New Testament.

While he does not specify any books in the Nah Hammadi library for condemnation, he does state:
“… nor is there in any place a mention of apocryphal writings. But they are an invention of heretics, who write them when they choose, bestowing upon them their approbation, and assigning to them a date, that so, using them as ancient writings, they may find occasion to lead astray the simple.”
Due to the above condemnations from church leadership, much of the Gnostic texts may have been destroyed in the early years of Christianity. Also, the books were not copied and distributed as extensively as the canon books of the New Testament, and so did not survive as long unless they were preserved in an area that prevented their decay. There was no project to preserve them such as the 50 Bibles produced by Eusebius in 331 under the orders of the Emperor Constantine (of which Codex Sinaiticus and Codex Vaticanus may have come from).
The Library Books Today

The Nag Hammadi library currently resides in the Coptic Museum in Coptic Cairo, Egypt. Researchers in Egypt and at the museum managed to retain most of the library not long after its discovery, and only had to recover one of the codexes which had made its way to Germany.