“I acknowledged my sin to you and did not cover up my iniquity. I said, ‘I will confess my transgressions to the LORD.’” -- Psalm 32:5
Sin could be unintentional. While a transgression is a deliberate trespassing. For example Peter who deliberately denied Jesus in public (Luke 22:34, 56–62).