Paul makes a very powerful statement here using a negative comparison. If righteousness comes through the law then Christ died in vain. The obvious implication is that righteousness doesn't come through the law, in other words, we are not made right with God by keeping rules. And yet, that's what so many believers base their whole walk and concept of God upon -- keeping rules. God wants me to do this or He doesn't want me to do that. The problem is that there is truth in that belief, it's just misplaced.
Sin is very real and still hurts us. There are very definitely things that God would have us do and things we are not to do. The issue is why. Motivation does matter. I cannot earn my salvation by good works. In Galatians 3:11 Paul goes on to say that "no one is justified by the law in the sight of God."
Jesus didn't die so that we could keep a bunch of rules. He died to bring us into fellowship with God. Using the marriage relationship as a comparison -- there's a very real difference between the man who doesn't cheat on his wife because he's afraid of getting caught and the man who would never do such a thing because he loves his wife. Neither man is cheating on his wife but the first man's attitude is wrong. The law may constrain sin but it doesn't fix the heart. Grace can fix the heart.
God calls us to a love relationship. Ticking off our checklist of do's and don'ts is a poor substitute for the real thing.
"For by grace you have been saved through faith,and that not of yourselves, it is the gift of God, not of works, that no man should boast." (Ephesians 2:8-9)