God forgives our* sins when we come to saving faith; when we repent and believe in Jesus Christ.
When you were dead in your transgressions and the uncircumcision of your flesh, He made you alive together with Him, having forgiven us all our transgressions, having canceled out the certificate of debt consisting of decrees against us, which was hostile to us; and he has taken it out of the way, having nailed it to the cross. (Colossians 2:13-14)
Christ took the wrath we deserved.
And then God forgets
You have cast all my sins behind Your back. (Isaiah 38:17)
As far as the east is from the west, so far has He removed our transgressions from us. (Psalm 103:12)
God doesn’t remember
Of course, God doesn’t forget in the human sense, but He choses not to remember, not to act on our forgiven sins.
And their sins and their lawless deeds I will remember no more. (Hebrews 10:17)
God sets us free
So if the Son makes you free ,you will be free indeed. (John 8:36)