The first Pantheon, or Agrippa's version built in 27 AD, was dedicated to all the Roman gods. The temple had a pagan bent, and was also used to deify the ruler of Rome. After successive fires destroyed this building, Emperor Hadrian reconstructed it between 118-125 AD. Hadrian's Pantheon is what we see today, complete with the Corinthian columns, rotunda and dome.
In 607 AD, the Pantheon finally became the church that's still open to worship. Pope Boniface IV consecrated the Pantheon as the Church of St Mary and the Martyres. The purported evil spirits residing in the Pantheon allegedly fled through the oculus following this change in religious order.
Hence, from a temple, to a kingly court and now a church, the Rome Pantheon has adopted different identities and evolved over two millennia.