There is a piece of cartilage called epiglottis that is located behind the tongue and covers the entrance of the larynx to prevent food from entering the windpipe.
When we eat food (swallowing) the epiglottis is closed so food does not enter the larynx and goes through the food pipe.
This is done unconsciuosly,i.e without our control ,hence food does not enter our windpipe.
In case the epiglottis is not closed ,the food gets stuck in our wind pipe and we suffer suffocation.
Hope this helps :)