That's because as you descend, the partial pressure of oxygen increases. You require somewhere north of 0.10 Pa02 for consciousness; at sea level you have 0.21 Pa02. So you can consume enough oxygen at depth that when you rise you grey or black out; it's common enough that if you take a breath-hold diving course they will train you to 1 - know how it occurs; 2 - dive in pairs (always one up, one down); and 3 - make sure you are weighted so that your body is buoyant by 20 ft or so.