The underlying principle in both passages is how disputes within the Church should be handled. Jesus gave instruction on this:
15 “If your brother sins against you, go and tell him his fault, between you and him alone. If he listens to you, you have gained your brother. 16 But if he does not listen, take one or two others along with you, that every charge may be established by the evidence of two or three witnesses. 17 If he refuses to listen to them, tell it to the church… (Matthew 18:15-17 ESV)
There is a 3 step process:
- Private: Handle it between the parties.
- Semi-private: Involve a few others.
- Semi-Public: Bring it before the church (semi-public as there is no instruction to make the issue to to those outside the Church.)
Paul's description of his action in Galatians indicate he is using the process Jesus taught. He is presenting his teaching privately before a small group; this is the semi-private step. In other words, Paul did not go only to one person (eg Peter), he went to a small group of reputable people.
1 Timothy 5:20 is giving instruction on how Timothy should handled "those" who persist in sinning, after he has heard, and decided the matter described:
Do not admit a charge against an elder except on the evidence of two or three witnesses. (1 Timothy 5:19 ESV)
5:19 describes the semi-private meeting and 5:20 describes what to do if that does not resolve the matter and the problem persists (despite Timothy's decision).
There is no conflict between the two passages. Paul's semi-private meeting in Jerusalem resolved the question. There was no need for him to go before all the church; he continued to preach the message to the Gentiles.