In her book, _A Separate God: The Origins and Teachings of Gnosticism_, which came out in French in 1984 and in English translation in 1990, Simone Petrement argues that the origin of Gnosticism was, quite simply, the theology of Paul and John.
In a rather long aside, she suggests the possibility that the founder of the Johannine theology might have been the Apollos mentioned in Paul's first letter to the Corinthians and in Acts. I'd like to present some of her argument about Apollos, if for no other reason than it makes for an "interesting story".
But, first, here are some things she says in the Introduction in regard to her main thesis on the origin of Gnosticism:
"It has been observed that if Gnostic thought can sometimes be found in writings that show no clear traces of Christianity, it has always, in every case, something to do with Judaism. Not that it agrees with the latter; on the contrary, it fundamentally opposes it, since one of its essential points is that the God of the Old Testament is not the true God. But if it opposes Judaism, it is always aware of it." (page 3)
"It is not surprising that ideas of a Gnostic type penetrated into non-Christian religions and traditions. Such ideas were present in certain strands of Hellenism (in Hermeticism, for example); they were present in Iranian religion; they were present in Kabbalistic Judaism; and they were present in Islam, among others. Thus, it is obvious that in some way there existed a general Gnosticism. But the question is whether this general Gnosticism preceded Christian Gnosticism or whether it is Christian Gnosticism that came first. Given the fact that all the forms of non-Christian Gnosticism seem to be attested later than Christian Gnosticism--not counting the fact that properly Gnostic ideas are less pronounced and less distinctive in the former than in the latter--one cannot be sure that Gnosticism was not initially Christian." (page 4)
"If, on the other hand, nothing in the New Testament clearly implies the existence of an already formed Gnosticism, if there is merely the indication of certain tendencies that agree more or less with one aspect or other of what must be second-century Gnosticism, then there is no proof that Gnosticism is either pre-Christian or even quite as old as Christianity, and it can be assumed that it was born of the simple development of these tendencies." (page 5)
"Why did this inversion of values come about in antiquity? Why did so many deny the value of the world and invert the meaning of creation? Why did they attribute creation to an inferior and blind Demiurge and not to the true God? If this reversal was brought about within and by Christianity, the crucifixion of Christ, the Pauline theology of the cross, is an answer. The condemnation of one just man is the condemnation of the world, a judgment upon the world. It henceforth implies (without waiting for the eschatological judgment) the existence of another world which is the place of truth." (page 10)
"If the Gnostic myth always implies knowledge of Judaism, it is because it is indeed Judaism with which this myth is concerned. But it is Judaism seen from the outside. It is concerned with the place Judaism ought to have in another religion, and this other religion cannot be anything other than Christianity. Gnosticism sprang from Judaism, but not directly; it could only have sprung from a great revolution, and at the time when Gnosticism must have appeared, such a great revolution in Judaism could have been nothing other than the Christian revolution." (page 12)
"Whatever the strangeness of some of the Gnostic writings, Pauline thought and Johannine thought are always to be found at their roots." (page 14)
"These problems, around which Gnostic speculation turns, are posed by Christianity and by it alone. They are not posed either by Hellenism or Persian religion or Judaism or by any other tradition that has been posited as a source of Gnosticism. They are posed by the doctrine of the Savior, the doctrine of redemption, and by the existence of a double revelation, the old and the new. They are posed by Pauline and Johannine theology, the two theologies fundamental to Christianity." (page 13)
"Perhaps it is because they no longer understand Christianity enough that so many scholars are now inclined to think that Gnosticism does not derive from it. The Gnostics said that humanity must be liberated from the religion of the world and that this was not possible except by a revelation that was not of this world. What did Christianity say but this? What did the Gospel of John say other than this?" (page 23)