Christian people all believed that there was one God. But many people thought God existed in three forms: God the Father, Jesus the Son, and the Holy Ghost who moves between them. In Perugino‘s painting you can see John the Baptist baptizing Jesus while God looks down from Heaven. The Holy Ghost (shown as a white bird) flies between them.
Jesus, like Jewish people and Zoroastrian people before him, prayed only to one god. But after Jesus was crucified, where did he fit in? By the 200s AD, writers like Tertullian were already saying that God, Jesus, and the Holy Spirit were three different beings made of the same stuff. In the 300s AD, some people – Arians – started to think that God and Jesus were more different. Other people – Catholics – stuck to the Trinity.
By the Early Middle Ages, most people in Europe were Catholics and believed in the Trinity. They believed that there was one God with three parts. (But the Albigensians disagreed.) When Mohammed started the religion of Islam in the 600s AD, though, he returned to the Jewish idea of just one God, with Jesus as his prophet but not a god himself. Most people in North Africa and West Asia went with this idea.
Even after the Reformation, most Protestants and Catholics in Europe and North America continued to believe in the Trinity. Then in the 1800s, some Protestants in North America rejected the Trinity again. These were the Mormons, the Unitarians, Jehovah’s Witnesses, and others.