On of the most radical elements of Lutheran theology was his notion of salvation by grace through faith.
Although Luther was not against doing good works, he had two major concerns about the way good works played into theories of salvation in the Roman Catholic Church of his period.
The first sense of "works" in the theology of the period had to do with church ritual, such as confession, penance, and communion. Luther was an advocate of what is sometimes called a "sola scriptura" doctrine, that humans need the Bible and faith for salvation, rather than having a church hierarchy act as gatekeepers to heaven. In other words, according to Luther, God did not judge people based on just the number of days a week they went to church or the number of rosaries they said, but instead looked into their hearts.
Next, the Renaissance Roman Catholic Church had a theory of a treasury of merits, of extra good deeds done by saints beyond what was necessary for their own salvation. The Pope claimed the ability to sell off these merits to rich people to reduce the rich people's time in Purgatory, a practice known as selling "indulgences". Luther was staunchly opposed to this, and to the notion that one could "buy" one's way into heaven, either with one's own good deeds or the good deeds of others. Instead, God granted grace to those who had faith.
Good works should naturally follow upon being in a state of faith as thanks for God's grace according to Luther, rather than being seen as a way, as it were, to bribe God into granting people salvation.