Oxidation is the gain of oxygen. Reduction is the loss of oxygen.
When magnesium burns, it gains oxygen: 2Mg + O2 → 2MgO. Magnesium gains oxygen, so magnesium is oxidised.
Now take copper oxide heated in hydrogen: CuO + H2 → Cu + H2O. Copper oxide loses oxygen, so it is reduced. Hydrogen gains that oxygen to form water, so hydrogen is oxidised.
Oxidation and reduction happen at the same time in one reaction, because oxygen lost by one substance is gained by another. A reaction like this is called a redox reaction.