As a sheet of muscle that basically stretches along the bottom of the rib cage, the diaphgram serves to inflate and deflate the lungs. As it contracts during inhalation, it increases the volume of the lungs, pulling air in. As it expands and shrinks the thoracic cavity, it pushes the lungs back down and forces the air back out. The lungs themselves are not muscle tissue and therefore cannot inflate or deflate themselves.
The diaphragm also helps with other functions, including when a person needs to vomit or expel waste, etc. as it can apply pressure to either the thoracic or the abdominal cavity, depending on the requirements.