When an individual consumes food or beverages, they must pass into the esophagus from the throat, in order to enter the digestive system. However, the windpipe (trachea) is in the same area and if food should enter there, it could block the pathway of air to the lungs.
The epiglottis is a cartilaginous flap of tissue that covers the larynx and prevents food from entering the windpipe when swallowing.
It is located behind the tongue and in front of the larynx. When swallowing, it covers the entrance to the larynx. When a person is breathing, it is upright so that air can easily pass into the respiratory system.
If the epiglottis becomes inflamed due to infection or injury, it can be very harmful to the individual. They may have difficulty with breathing or swallowing. This condition is known as epiglottitis.
I have included a link showing a diagram of the location of the epiglottis.