While it's now one of the cornerstones of the Christian faith, Jesus was not originally considered to be God. As evidenced by verses like Acts 2:22, 2:36 and 13:32-33, the earliest Christians thought he was a mere man whom God granted the status of Messiah at the resurrection. Later Jesus was thought to gain this title at his baptism (Mark 1:9-11), and then at his birth (Luke 1:30-35). Finally in John we see the fully developed view of Jesus' eternal existence as God himself (John 1:1-14).
Ehrman says that this increasingly deified view of Jesus developed independently in different places. Based on details like the "we" in John 21:24-25, John may have been written by a Jewish community, who rationalized the rejection of friends and relatives by assuming they had special access to the truth of Jesus' divinity. Others began believing that Jesus was divine based on his "cosmic judge" position as the Son of Man, while still more drew this conclusion from the fact that both Jesus and the OT God used the title of "Lord." And among former pagans, who were used to demigods born of a god and a human (e.g. Heracles), perceiving Jesus as God would have been easy.
The Trinity doctrine developed to solve the problem of how Christianity could continue as a monotheistic religion. The Ebionites decided that Jesus was not God, the Marcionites concluded that the OT God and the God of Jesus were two distinct entities, and the Gnostics thought Jesus was one of many divine beings. However, the two most popular doctrines were modalism, where God is one being who expresses himself in three roles, and Arianism, where God is one "substance" with three distinct persons. Even after Arianism won out, some insisted that the Son's position must be inferior to the Father's. But in 325, the modern view of Father, Son and Spirit as equal persons of the divine substance (problematic as it may be) was established.
Neither Jews nor the earliest Christians believed in immortal souls, heaven or hell. The OT prophets simply believed that God would inflict earthly punishment on those who sinned against him. The apocalypticists, such as Daniel, Jesus and Paul, believed God would come to judge the world and set up a new kingdom on earth, in which those who were dead would be physically resurrected. But when Jesus didn't come back as expected, people had to resolve their cognitive dissonance by reinterpreting this view. This is especially evident in 2 Peter, whose author desperately tries to explain that "with the Lord one day is as a thousand years." Eventually the judgment was reworked so that it came, as Ehrman puts it, "not at the end of the age but at the end of one's life," when one is sent to either heaven or hell.
The fact that Christian doctrines changed significantly over time does not in itself mean that they're false. But I agree with Ehrman when he says that their formation process looks distinctly human: it's full of fierce disagreements, political struggles and flimsy rationalizations. I would never expect such chaos and illogic if God, the perfect communicator, were truly in control.