The difference is caused by differences in electron configurations.
Work Step by Step
For oxygen, gaining one electron gives it the electron configuration of a halogen, which is extremely unstable. Thus, the first electron affinity of oxygen is negative. However, the second is positive, for oxygen starts two away from the electron configuration of a noble gas, which is a favorable state.