Why do people yawn? I heard yawning is a sign that your brain isn't getting enough oxygen. Is this true?

True. Yawning is a sign of tiredness. Additionally, when your carbon dioxide (the gas given off with exhaling) level starts to rise in your body, it does stimulate the brain to cause you to yawn. The theory is that the yawning will cause you to take a deep breath and inhale more oxygen and exhale the excess carbon dioxide.
Perhaps. Similar to sighing, yawning is a reflex to re-expand your lungs, which may have some of their air sacs not fully expanded due to periods of shallow breathing. ..