Paul goes to Jerusalem (after he had been absent for 14 years) and preaches the true Gospel of Jesus Christ. The Church in Jerusalem had accepted Titus even though he was a uncircumcised Greek. Paul preaches that God favors no one. The leaders in Jerusalem (James, Cephas and John) accept the ministry of Paul and his preaching to the gentiles.
Paul publicly expresses his disapproval of Peter, because he had separated himself from the gentile Christians in that area. Paul has to remind Peter that the Gentiles are justified before God, not in their keeping of the law, but by the works they put forth in the name of Jesus Christ.