The fact that the diaphragm moves upward and the chest cavity becomes smaller describes the action of the diaphragm and chest cavity when you exhale and squeeze air from the lungs.
During inhalation muscles increase the size of the thoracic (chest) cavity and expand the lungs. This increases their volume, so pressure inside the lungs decreases. As a result, outside air rushes into the lungs.