I would guess it is in there because G is the 5 chord in the key of C and a 7th chord wants to resolve to another chord so when you play G7 it wants to go the the 1 chord C
Try playing c-G7- C and notice how it sounds complete when you go back to C.
So in this case I would consider both G or G7 to be the 5 chord.