You may be copying someone else when you yawn and/or regulating body temperature. Those are the two main reasons scientists believe are responsible for the common yawn.
A yawn is a deep intake of breath that is accompanied by a widening of the mouth and stretching of ear drums. It is followed by a large exhalation of air. People often stretch their arms and other body parts while yawning.
Yawning to Regulate Temperature
Frequent yawning has been observed in a ‘thermal window’ when it is cold/hot enough outside for the yawned air to cool/warm the body down, but not so cold/hot that the intake of air would be harmful. People in warm places tend to yawn more in winter months while people in cold places yawn more in summer months.
Yawning to regulate body and brain temperature is particularly helpful, and often observed, just before people start a strenuous or stressful experience. These include a gym workout, sporting contest or just before public speaking. Yawning cools the brain just a little, which can help it work more efficiently.
Yawning in Empathy
Contagious yawning has often been observed where one person’s yawn appears to be transmitted to others who witnessed it. The same phenomenon has also been observed among numerous animal species, including primates and dogs.
Group yawning may be partly explained by everyone being in the same place and having a similar experience. But there appears to be a strong psychological component as well. The reasons are not fully understood but are conjectured to reflect our tendencies to mimic and empathise with others.