In the early 1950s, a collection of Coptic texts, bound together some time in the late fourth century C.E., began to make their way onto antiquities markets in Egypt. It was a volatile time there: the dissolution of the Kingdom of Egypt in 1953 led to the dismantling of European control over Egypt's material and cultural resources. One of the books in this Coptic library was taken out of Egypt and was held in Switzerland; the new Egyptian Department of Antiquities refused to let any western scholars see the remaining twelve books until it was repatriated, which it eventually was. A UNESCO team of scholars (primarily from the U.S. and Europe, with some Egyptian cooperation) was given permission to transcribe, translate, and publish these books; much of this work took place in U.S. institutions of higher education (such as Claremont Graduate School and Harvard University).
The first texts to reach wider readership were from "Codex I" (also known as the Jung Codex), the book that had made its way to Switzerland: most famous among these early texts is the Gospel of Thomas. Most of the 50 or so other texts, as it turned out, were also esoteric works, originally composed in Greek but translated at some point into the late Egyptian dialect of Coptic, with strong affiliations with "heretical" groups called Gnostics hitherto known almost entirely from ancient orthodox refutations. Gnostic was a term used by these orthodox opponents of early "heretics," meaning "one who knows," but it was also quickly applied to this esoteric library as a whole. When scholar Elaine Pagels published her popular work on these texts she called them "the gnostic gospels."
If much of this acquisition and study took place in Cairo, the U.S., and Europe, why is the pin in my map fixed in southern Egypt, near a place called Nag Hammadi?
Beginning the 1970s, a story circulated about how these leather-bound books filled with Coptic translations of (primarily) early Christian texts composed in Greek came to be found: in 1945, two brothers were digging for fertilizer near this site when they came across a large jar buried under a rock. One of the brothers feared djinn (spirits) might be trapped inside; another was hoping for gold. They broke open the jar and found neither djinn nor gold but several leather-bound books. They took them home for safe-keeping (where their mother burned many pages for fuel). In the midst of a blood feud, they were unable to do anything with the books right away; eventually they sold them on the antiquities market. One of the brothers, named Muhammad 'Ali, told this story decades later to James Robinson, the head of the UNESCO committee working on the texts (you can also see him telling this story in this clip from a 1980s documentary; here Muhammad poses for a photo in 1975 with Robinson's wife). The texts soon became known as "the Nag Hammadi library."
There is much debate as to the veracity of the story (or even the identity of Muhammad 'Ali): it plays into colonialist tropes about the "accidental" discovery of precious antiquities by locals which must then be "saved" by western expertise. (The assertion of sovereignty by the nascent nation of Egypt complicated this narrative.) Robinson remained convinced of its veracity and led excavations in the 1970s to find the site of discovery (see plentiful photos at the Special Collections of the Claremont Colleges library here, along with photos of the individual codex leaves). The idea of a buried jar also gives these texts a mystique not found in similar stories of the Dead Sea Scrolls: that these were secret texts ("apocrypha" in Greek) that had to be hidden because they were "heretical," i.e., countered the dominant norms of Christian orthodoxy. Their recovery in the 20th century gave fuel to scholarly and popular theories of "primitive heresy," that is, the idea that an original (and theologically more interesting) early Christianity was suppressed by later institutions of patriarchal orthodoxy.
There has been an enormous amount of scholarship on these text, from close textual studies to transformative histories of Christian heresy and orthodoxy. They have also generated an enormous amount of popular attention from audiences eager for countercultural spirituality (see the various essays, along with translations and essays on the texts, here). Along with the Dead Sea Scrolls, these text have fed into the impulse (both scholarly and popular) to recover "lost," "secret," and "unorthodox" traces of Christian origins.
You'll find below links to novels that make particular use of the idea of "primitive heresy" (and, at times, specifically the finds at Nag Hammadi) in their plots.