Because there is a G note in each chord, keep your fifth finger on the G note as you change chords.
Play slowly and evenly. Count aloud as you play and make sure you change chords on the correct count.
Also, keep your fifth finger on the G note when changing back from the G chord to the C chord. This will make changing chords very easy.
Before playing songs with chords, practice each part separately. First practice the melody of the song by itself (right hand part), then practice the chords and bass pedals by themselves. Once you have learnt all them all together, paly them all together. Practice slowly and evenly, and count as you play.