The story of the life of Jesus was transmitted into the gospels by a combination of written and oral sourcing. Exactly what the sources were, we do not know. The probable timeline agreed on by most scholars looks something like this:
30-33 AD: The ministry of Jesus in Galilee and Palestine.
33-40 AD: Formation of the Church, creation of the earliest creeds.
40-60 AD: Paul and James write their epistles.
60-70 AD: Mark's Gospel written.
70-80 AD: Matthew's and Luke's Gospels and the Acts of the Apostles written.
After 80 AD: John's Gospel and latter epistles written.
While we don't know exactly how the information was transmitted, scholars have made informed speculation. There was probably a document called 'Q' bearing the information shared by Matthew and Luke but not Mark. In addition, there were probably separate early sources for material included only in Matthew or only in Mark, commonly called 'M' and 'L'. Luke, at the start of his gospel, refers to "many" previous writings about the life of Jesus. While we can't pin exact dates on these, dates of 50-60 AD seem likely.
As for oral transmission, some people used to assume that it was necessarily unreliable. However, anthropologists have studied oral transmission in primitive cultures and they've found that while works don't stay exactly the same word-for-word, the fundamentals of the work don't change in oral transmission. There can be oral transmission of works as long as 100,000 words and they can be transmitted reliably for centuries. Compared to this, the transmission of the gospel material for 20, 30, or even 40 years would not be remarkable at all.
(It is worth nothing that it's utterly remarkable that anyone would write a biography of Jesus a mere 30 or 40 years after his life. In the ancient world, people rarely wrote biographies of a figures until several centuries after the figure's life. Yet obviously historians trust such biographies all the time.)
To read more about what scholars know about the gospels and their creation. I'd suggest the book
Lord or Legend: Wrestling with the Jesus Dilemma, by Gregory A. Boyd and Paul Rhodes Eddy.