Yawning is a deep usually involuntary intake of breath through a wide open mouth often as an involuntary reaction to fatigue or boredom. No one really knows if yawning is contagious or not. It has been a mystery among scientists for centuries.
Nobody knows why and there seems to be no speculation either.
Yawning is a physiologic mechanism coming from being bored, sleepy, waking up slowly, etc. It is considered to be a slow breath. Yawning is psychological because you can tell yourself not to do it and you won't. This is the reason why it is not contagious. Because if it was contagious, you would not be able to do anything about it.