11 But when Peter came to Antioch, I had to oppose him to his face, for what he did was very wrong. 12 When he first arrived, he ate with the Gentile Christians, who were not circumcised. But afterward, when some friends of James came, Peter wouldn’t eat with the Gentiles anymore. He was afraid of criticism from these people who insisted on the necessity of circumcision. 13 As a result, other Jewish Christians followed Peter’s hypocrisy, and even Barnabas was led astray by their hypocrisy.
14 When I saw that they were not following the truth of the gospel message, I said to Peter in front of all the others, “Since you, a Jew by birth, have discarded the Jewish laws and are living like a Gentile, why are you now trying to make these Gentiles follow the Jewish traditions?
15 “You and I are Jews by birth, not ‘sinners’ like the Gentiles. 16 Yet we know that a person is made right with God by faith in Jesus Christ, not by obeying the law. And we have believed in Christ Jesus, so that we might be made right with God because of our faith in Christ, not because we have obeyed the law. For no one will ever be made right with God by obeying the law.”[d]
17 But suppose we seek to be made right with God through faith in Christ and then we are found guilty because we have abandoned the law. Would that mean Christ has led us into sin? Absolutely not! 18 Rather, I am a sinner if I rebuild the old system of law I already tore down.
19 For when I tried to keep the law, it condemned me. So I died to the law—I stopped trying to meet all its requirements—so that I might live for God. 20 My old self has been crucified with Christ.[e]
It is no longer I who live, but Christ lives in me. So I live in this earthly body by trusting in the Son of God, who loved me and gave himself for me. 21 I do not treat the grace of God as meaningless. For if keeping the law could make us right with God, then there was no need for Christ to die.
Peter was fearful of those Jewish watchdogs who were pushing for the old system of the circumcision, so he avoided mixing with the gentile christians. That was Peter's hypocrisy and this caused other Jewish Christians to follow suit. Paul had to confront him on this. Have a relook at what Paul said to Peter.
In contrast, Jesus handled the Pharisees very well and without fear when they came to spy out what He did on the Sabbath healing the sick. Jesus gave them a good lecture!
In verse 21, what it means is that if a living relationship with God could come by rule-keeping, then Christ died in vain, i.e., died unnecessarily, i.e., we are telling God the Father that there is no need for Him to send His begotten Son to die for our sins i.e. we are telling God that He got His plan of salvation wrong!
"Yet we know that a person is made right with God by faith in Jesus Christ, not by obeying the law. And we have believed in Christ Jesus, so that we might be made right with God because of our faith in Christ, not because we have obeyed the law. For no one will ever be made right with God by obeying the law "(v 16)