The human body has two lungs rather than one because having two lungs increases the surface area available for gas exchange to occur. The lungs are responsible for taking in oxygen and removing carbon dioxide from the body. The air we breathe in travels through the trachea and branches into smaller and smaller tubes called bronchi and bronchioles until it reaches the alveoli, which are tiny air sacs in the lungs.
The alveoli are the site of gas exchange where oxygen from the air is diffused into the bloodstream and carbon dioxide is diffused out of the bloodstream and into the lungs to be exhaled. Having two lungs allows for more alveoli to be present and thus more surface area available for gas exchange to occur. This results in a greater amount of oxygen being taken in and carbon dioxide being removed from the body with each breath. Additionally, having two lungs provides a backup system in case one lung becomes damaged or compromised in some way, allowing the other lung to continue functioning and sustaining the body's need for oxygen.
It is important to note that while having two lungs is the norm for humans, some individuals may have only one functioning lung due to medical conditions or surgical interventions. In these cases, the remaining lung is able to adapt and compensate for the loss of the second lung.