From collective oscillations to collective chaos in a globally coupled oscillator system