A protestant brother in Christ wanted to know how Catholics reconcile our beliefe that St. Peter was first Pope and our beliefe in Papal infallibility with St. Paul's rebuke to St. Peter at Antioch, which is recorded in St. Paul's Epistle to the Galatians. This is my reply:
Hey Jasawa and thanks for the question. :)
First, I don't think there is a clear Catholic teaching on exactly when St. Peter became Pope, but he clearly had that office by the time he presided at the selection of St. Matthias. So yes, by the time the event St. Paul describes in Galatians happened, St. Peter was Pope. And no, St, Paul wasn't wrong; Galatians is Sacred Scripture. If Scripture says Peter was wrong, then he was wrong. Actually, St. Paul's action is used by St. Thomas Aquinas as the primary example that one may, sometimes, correctly rebuke one's superiors.
So, does this contradict infallibility? I don't think so. To understand why, we need to look at exactly what infallibility is and also exactly what was St. Peter's error. Vatican I spells out the criterion for an infallible Papal statement, the criteria are actually quite strict. Wikipedia lists them here. One of the criteria is that the Pope has to be speaking in his capacity as pastor of the whole Church. So St. Peter could, theoretically, have been teaching heresy in the dining room at Antioch without contradicting this teaching.
However, I don't think we have warrant to conclude that St. Peter was teaching heresy at all. St. Paul writes:
11 When Cephas came to Antioch, I opposed him to his face, because he stood condemned. 12 For before certain men came from James, he used to eat with the Gentiles. But when they arrived, he began to draw back and separate himself from the Gentiles because he was afraid of those who belonged to the circumcision group. 13 The other Jews joined him in his hypocrisy, so that by their hypocrisy even Barnabas was led astray.
From this passage, it seems to me reasonably clear that St. Peter was, in fact, teaching the correct doctrine but, as a result of the influence of certain men, he was hypocritically failing to live in accordance with that doctrine. This undoubtedly reflects poorly upon the great man, but has nothing to do with infallibility at all.
I hope this helps.