1My dear children, I write this to you so that you will not sin. But if anybody does sin, we have one who speaks to the Father in our defense—Jesus Christ, the Righteous One. 2He is the atoning sacrifice for our sins, and not only for ours but also for the sins of the whole world.
Why did John write this letter? "So you will not sin."
There were some controversies in the church already, and some false teachings going around. Being not just one of the original 12 disciples, but close to Jesus personally, John wanted to inoculate or vaccinate early believers from being misled. There are always people out there with wrong or misleading information.
It could be that they're simply mistaken or that they're motivated by profit, power, or fame, or for whatever reason, they may actually want to corrupt or destroy God's message of forgiveness. John wrote these letters to protect his readers from lies and/or mistakes that could cause them to sin. Ah, but he also assured them (and assures us) that if/when we mess up, we have an advocate, a defense attorney, someone who has the ear of God the Father- Jesus Himself. No matter how badly we've messed up in our lives, He has paid for us.
Wouldn't it be great to have Warren Buffett or Bill Gates show up and pay off all your credit cards and loans and mortgage and offer to pay your bills from here on out? To be totally debt-free through no doing of your own? That's exactly what we have from a spiritual (though not financial) point of view. Jesus is the once and for all sacrifice that makes us right with God.
And not just us. He died for everyone for all time. Granted, if anyone rejects His forgiveness, He isn't going to force it on anyone. Skeptics complain that if there really is a loving God, why doesn't He just save everyone? Well, hate to burst your bubble, but He did! Unfortunately, people don't believe it, don't accept it, deny it and refuse it- even ridicule and belittle it.
That's my explanation in a nutshell of a sad aspect of society's reaction to the Gospel- Here in these verse though John isn't talking to all people, he's talking to fellow believers and he's reminding them that Jesus- not anyone else, and especially not ourselves is the atoning sacrifice. THAT is the core of the Gospel, the basis of Christianity.
Some of the heresies, the false teachings John wanted to warn his readers about claimed that Jesus was just another human and not God's only begotten Son, and some of them taught that anyone could become "godlike" if they just got in touch with their inner light. But only Jesus is the light, and any light we receive is from Him. We can become "Christ-like" only through Him.
But again, in the book of 1 John, John wants to help his readers avoid these errors, but in verses one and two, he's also assuring them that if they fall prey to these false teachings but realize their mistake, God who is faithful and just will forgive them because of what Jesus did on the cross.