The doctrine of the Trinity is not an easy doctrine to grasp, and from the beginnings of the church there have been groups who have attempted to deny its validity. Though the word itself does not appear in scripture it is a term used to describe the manifestation of God as Father, Son, and Holy Spirit. Though the Arian controversy brought the doctrine to the forefront, we can see the doctrine being defended by the early Church Father Irenaeus. During the time of Irenaeus the Gnostic heresy was, and in fact, he was the first to use the term specifically.
The Gnostics denied anything material, so as a result they rejected that Jesus was a physical person and was not preexistent. In his work Against Heresies, Irenaeus, writes “The Church, though dispersed through our the whole world, even to the ends of the earth, has received from the apostles and their disciples this faith: [She believes] in one God, the Father Almighty, Maker of heaven, and earth, and the sea, and all things that are in them; and in one Christ Jesus, the Son of God, who became incarnate for our salvation; and in the Holy Spirit, who proclaimed through the prophets the dispensations of God.” The Trinitarian language noted here would go on to appear in the Nicene Creed.
The church father Tertullian developed the term Trinitas, or Trinity. Tertullian taught that the Father, Son, and Holy Spirit were of one substance. One was not created from the other, but all preexisted as one being. Another Church Father, Origen, attempted to describe the Trinity in a Philosophical way. He stated that the Son was the Logos and was superior to all created creatures, and that the Holy Spirit dwelled within the saints. In regards to this James Stevenson writes in regard to Origen, “The God and Father, who holds the universe together, is superior to every being that exists, for he imparts to each one from his own existence that which each one is; the Son, being less than the Father, is superior to rational creatures alone (for he is second to the Father); the Holy Spirit is still less, and dwells within the saints alone.” From these two church fathers two Greek terms were used at the Council of Nicea. Those terms were Homoousios which means “of one substance”, and homoiousios which means “of similar substance.”
These Greek terms were also philosophical and would be the basis for the Filioque. Philosophical language was increasing in the church for a couple reasons. For one it was a way to combat an attitude in the Roman Empire that Christians were ignorant atheists. The romans claimed that Christians were atheists because of their denial to worship the Roman gods. The Christian apologists, such as Justin Martyr, appealed to Philosophy and reason as a way of proving the Christian ideal. This language was used throughout the early church and terms that were used previously were derived from that. A second reason is that philosophers at the time of the early church believed in a supreme being. Who that Supreme Being was a matter of debate, and Christians were up to the challenge. This went a long way in evangelizing and spreading the gospel to a people who were told that Christianity was atheistic and dangerous to the empire.
Much more can be written about this topic, and many books have been written about it. The early church dealt with a lot of false teaching and the early church fathers took them to task. The Trinity is a doctrine that is essential to the Christian faith, and must be defended. I would encourage you to research the sources cited as well as Jesus in Trinitarian Perspective edited by Fred Sanders & Klaus Issler, and The Story of Christian Theology by Roger E. Olson.
“Anf01. The Apostolic Fathers with Justin Martyr and Irenaeus,” Christian Classics Ethereal Library, accessed June 1, 2016 July 13, 2005, http://www.ccel.org/ccel/schaff/anf01.ix.ii.xi.html.
Elwell, Walter A., ed. Evangelical Dictionary of Theology. 2nd ed. Grand Rapids, MI: Baker Academic, 2001.
Gonzalez, Justo L. The Story of Christianity: The Early Church to the Dawn of the Reformation. New York, NY: Harperone, 2010.
Kreeft, Peter, and Ronald K. Tacelli. Handbook of Christian Apologetics. Downers Grove, IL: IVP Academic, 1994.
Stevenson, J., ed. A New Eusebius. London: Spck, 1987.
Water, Mark. Bible Teachings Made Easy. Hampshire, UK: Hunt and Thorpe, 1998.
 Walter A. Elwell, ed., Evangelical Dictionary of Theology, 2nd ed (Grand Rapids, MI: Baker Academic, 2001), 502.
 Peter Kreeft and Ronald K. Tacelli, Handbook of Christian Apologetics (Downers Grove, IL: IVP Academic, 1994), 105.
 “Anf01. The Apostolic Fathers With Justin Martyr And Irenaeus,” Christian Classics Ethereal Library, accessed June 1, 2016 July 13, 2005, http://www.ccel.org/ccel/schaff/anf01.ix.ii.xi.html.
 Mark Water, Bible Teachings Made Easy (Hampshire, UK: Hunt And Thorpe, 1998), 44.
 J. Stevenson, ed., A New Eusebius (London: Spck, 1987), 1653.
 Justo L. Gonzalez, The Story of Christianity: The Early Church to the Dawn of the Reformation (New York, NY: Harperone, 2010), 182.