Why did my soy milk turn sour
"Safe" does not mean 100% nothing will happen, it means that, even if all assumptions are met perfectly, there is a tiny chance that you will get bacterial growth. Even more likely is that not all assumptions were met. Maybe there was a small problem in the production process - storage procedures assume that food is produced under nearly sterile conditions, but maybe your milk was just over some threshold of contamination. Or possibly, your fridge is a bit over the recommended upper limit of 4 C. 

However the spoilage organisms got into a growth phase, they soured the milk. Throw it out. If the fridge is under 4 C (measure in the place where you keep the milk - the door is frequently somewhat warmer), it is unlikely to happen again anyway.