Do you ever say one thing and then do another? Paul opposes Peter in this passage because Peter, being convinced and convicted of the truth of the gospel, yet acts in such a way as to deny that truth. Peter was not acting in line with the gospel, but hypocritically, out of fear and consequently influenced others to do the same. This is a key moment in the future of the gospel. Upon the outcome of what takes place stands the doctrine of justification and the truth that we are saved by grace alone, through faith alone in Christ alone.
Like Paul, Christians today must be aware of their influence as ambassadors for Christ and must be careful not to act out of fear of people. We must be careful of hypocrisy that believes one thing and does another.