In NaCl electrolysis, why does chlorine ion get oxidized but not oxygen ion?
I am afraid that as stated in another answer there is no simultaneous evolution of oxygen or chlorine during controlled electrolysis. It all depends on the concentration of ions in the solution. Keep in mind that the concentration of water is 55 M, so the ion concentration is nowhere near it no matter what you do!

The key reason is that the electrode potential of chlorine/chloride couple is quite different from that of oxidation of water, so if you have a high concentration of chloride ion, chlorine is oxidized first, once chlorine falls below a certain threshold, water begins to oxidize. Nernst equation can help in predicting that.