If its from the Bible, then which part and who wrote it. I am pretty sure Jesus himself never said that, even it was attributed to him later on. So, I am trying to understand the historical context of the idea, its political and cultural implications/reasons.
Jesus couldn't have said that he died for our sins because, after all, with the very limited exception of what he is narrated to have said following his resurrection, he hadn't died when he was saying things.
The idea is stated repeatedly in the New Testament, specifically in the epistles (quotes from the NIV):
The first of these is particularly important since it's the earliest and its authorship by the Apostle Paul is generally accepted by scholars. Historically, Paul's work came immediately after Jesus, and constitutes one of the most important elaborations of Christian theology. The epistle to the Romans, specifically, is widely accepted to have been written around the 50s CE, so certainly not long after Jesus himself.
The doctrine you're describing, in fact, is very much one of the earliest and most central components of Christian belief. Bart Ehrman observes specifically that it was Paul who "came to believe that it was only through the death of Jesus that a person could be made right with God" (Peter, Paul, and Magdalene, p. 114), but we know there are pre-Pauline precedents, since Paul formulaically lists the fact that Jesus "died for our sins" among other basic confessions of Christian belief in places like Corinthians 15:3. Hence the theologian Anthony Thiselton has remarked exegetically that the idea that "Christ died for our sins ... belongs to the bedrock of pre-Pauline apostolic doctrine, going back to Jesus himself" (First Corinthians: A Shorter Exegetical and Pastoral Commentary, p. 257). Even if Thiselton's not necessarily right in extending the idea to Jesus himself, it is certainly one of the very oldest widely accepted Christian doctrines.