When Paul brought the gospel to the Jews, they had been under the law as a people for 1500 years and they were pursuing righteousness by trying to keep it - and yet falling short (see Rom 9:31). Paul told them that there was no life or righteousness in the law, and that they had to die to the law in order to be joined to Christ and bear fruit to God (Rom 7:4).
When Paul brought the gospel to he Gentiles, he told them no such thing. They didn't need to be freed from the law or die to the law, because they had not been under the law. In fact, they had not even been pursuing righteousness (according to any law or works)! (Rom 3:30) Rather, Paul simply told them that they had been aliens and strangers from Israel and the covenants and God's promises, and they had been been "far off" from God, "having no hope and without God in the world." (Eph 2:12-13)The Gentiles had never had a covenant between them and God. People who have never been in a covenant with God - a covenant that He Himself came up with - have no clue what it's like to actually be in a covenant like that, and would have no clue what it's like to have to die to that in order to be joined to God. Dying to the law was for unbelieving Jews, in order for them to be joined to Christ and made alive to God. It wasn't for Gentile believers who had resorted to the foolishness of adding law to their lives. Gentiles didn't need to (and couldn't!) die to the law. The Gentiles who were already believers simply needed to stop the foolishness of believing the lie that adding the obsolete Jewish law to their lives would further perfect them. What had happened is that they had been brought near to God, not by freedom from law, but simply by the blood of Christ. A great big "PERIOD" needed to be added there. That's it. It was done. They were in Christ and perfected by the blood of Christ. Period.
It wasn't until the Gentiles - who, again, had never been under the law and never had any relationship with it whatsoever - began believing in Christ, that certain Jews began to tell them that they had to keep the law in order to be further justified or "perfected." In Galatians 3, Paul called them "foolish" for believing this, and proceeded to tell them of what life was like for himself and for other Jews who had actually been under the law. They had been under a curse. The law had kept them "under guard." They had to keep the law in its entirety, which was an impossibility.
The law had been in effect until the Seed (Christ) should come. And then Christ redeemed Israel from the curse of the law, and led them to God's promise of righteousness by faith. The Gentiles had never been under anything at all like this! (The law, the curse, the bondage, etc.) So why would they want to subject themselves to it? This is the freedom that Paul was desiring for the Gentiles. They had never been in bondage like the people of Israel had been, but now they were beginning to subject themselves to this yoke that Israel could never bear!
Paul wrote to the Galatians, not to tell them that they must die to the law. But rather to question why they would want to subject themselves to the law that he and the people of Israel had to die to. When Paul told them in Galatians 5 to stand in the liberty by which Christ had made them free, he was talking about the freedom they initially had - when they had never been under any law toward God, but had come to him simply by faith.
But what about Romans 2? Doesn't Paul say the Gentiles had some sort of "law unto themselves"? Well, in order to understand what Paul is saying, we've got to read him as a whole, not just in bits and pieces. Paul brought up several things in Romans 2 that aren't actually true, such as saying that it's those who do good who will obtain eternal life, and that people will be justified by being "doers of the law." We've got to understand that much of what Paul said in Romans 2 was a matter of him building up to a larger point.
It's the same as the hypothetical example Paul gave in Romans 2 of a Gentile keeping the law, and having the work of the law written in their heart. Even the Jews didn't have the work of the law written in their hearts! Paul was simply pointing out to the Jews that just because they had the law, that didn't mean they were "doers of the law," and therefore they weren't justified by the law like they thought they were. Paul had just told them that they have no right to judge others, because they themselves do the same things. Paul isn't actually saying that Gentiles have the work of the law written in their hearts. He's saying that if a Gentile, who does not have the law, was to do "by nature" what is written in the law, he would be justified as a doer of the law. And the Jew, who has the law, but doesn't do what is written in the law, would not be justified.
But in the end, what Paul is leading up to is that no one actually keeps the law, whether Jew or Gentile. Paul is simply showing the Jews that just because they are the ones who have the law, that doesn't mean that they're righteous. Jews had the law, and were pursuing righteousness by the law, but in the end they weren't actually "doers of the law." So they had to die to the law and believe in Christ in order to become righteous - by faith alone. Gentiles never had the law and therefore never died to the law. They came to God simply through the blood of Christ, as they were once "far off" from God but believed and were brought near.