There are many reasons different traditions entered the ancient church & why the church eventually approved them.
There's a belief the Apostles were in complete uniformity with their teachings & so every church everywhere they set up taught the same thing & stayed to the Apostles' teaching strictly. The reality is it's not unreasonable at all 12 apostles would disagree on teachings. They agreed on fundamentals, yes, but each one would've brought different ideas to the table. If God hadn't intended each Apostle's individuality, he wouldn't have used 12. (One of the Gospels says 70 were sent out at one point)
Christianity spread fast. Acts talks how people converted at thousands at a time. It would've been so easy for non-fundamental traditions to enter. Christianity is considered a liberal religion because it allows so much.
We know from history & the Bible that Bishops & deacons were set up to oversee church's. This may sound like correct doctrine would've been preserved, but things that seem okay were allowed in & overtime they snowball & balloon into something not resembling what was originally allowed at all. This is called accretion. So what we have now may not be because anyone was trying to be nefarious, but they were trying their best, then later someone misinterpreted what they were saying & it got a bit worse, then someone else misinterpreted what they were saying & it got a bit worse, & so on.
There's a belief these things would've been stamped out at Councils when church leaders meant to decide doctrines, but congregations didn't live in a bubble. What one congregation was doing would've spread to the congregation next door, which would've spread it to the congregation next door to them, & so on. All over the region. So when these bishops met, it would sound to them like it was a universal doctrine that had in fact been started by one individual congregation.
Also, people back then were very superstitious. Even the Christians. I could easily see a church leader saying "If this teaching was this bad, God would've struck us down" or "he would've struck the congregation down." Stuff like that. They may've even cast lots on issues.
Bad doctrine was able to enter because converts brought in their own ideas. Congregations thought they were okay because they thought similarily. The leaders thought they wouldn't lead to ruin.
Meanwhile, Gnosticsm & other heresies were popular in a lot of congregations. It had entered because they claimed their teachings went back to Apostles. The Church we now know rallied in union against these & was able to defeat them because Paul's early letters were presented. (The Gnostics rallied, forging their own letters & Gospels which they claimed could be traced back, but they were proven frauds. If a Gospel of Peter pops up 150 years after Peter died & no one knew about it till now, of course it's a forgery) So because Paul's letters are so early & so widespread & can easily be traced to him, we know his teachings are correct. The Gospels of Mark & Matthew, which are also early Gospels, put Gnosticsm to bed as well. (Some people think John was written to specifically combat Gnosticsm, but the Gnostics would be able to say it was written too late & a forgery, which they did not)
After putting a dent in Gnosticsm, the Church focused more on unity & excommunication became popular (even tho 'heretical' ideas may've still been held by individual leaders in good standing). Accretions were still able to enter tho & continue to enter to this day.
So to answer the OP: different doctrines have always been present. Sometimes they were defeated, other times they were allowed to grow. People are individuals & bring individual ideas. Not everything can be traced & everything guarded against. Just as the Hebrews in the Old Testament strayed from God (count how many times!) while remaining his, so can the Church. In regards to sources, what doctrine are you specifically wondering about?