The word, "trinity" does not appear in the Bible.
People began to understand that God, known already to the Jewish people, and Jesus were somehow the same: that when Jesus acted, it was God who acted; that when Jesus spoke, it was God who spoke through him.
After the resurrection, when Jesus returned to the Father, believers discovered that Jesus was still with them, through the power of the Holy Spirit. And the experienced that where Jesus was, there also was the Father.
SO slowly there developed the language to express thuis reality: God=Father, but also Jesus, and also the Spirit.
God is One, of course.
God is also
Three - but three in One.
Ponder that forever and never come to the end of it!