Why do humans sneeze out mucus if it's a good thing?
Indeed, mucus is essential for in this case protecting the respiratory pathways, which includes the nasal cavity and the pharynx, against different threats, such as microbes. Sneezing, which is initiated by virtue of the activation of mechanoreceptors in the upper parts of the respiratory system, leads to a buildup of intrathoracic pressure, due to the contraction of expiratory muscles against a closed glottis. The pressure gradient, when the glottis opens, will then lead to the rapid flux of air from the lungs, through the respiratory tract and out through the mouth and the nose, whereas mucus containing the initial irritant will follow, merely due to the forces at play. 

Note that the epithelia in the resp. tract normally transport the mucus containing everything from microbes which have been breathed in, and different particles, to the oropharynx, so as to allow you to swallow and take it to the GI tract instead. 

For further reading, I recommend Boron Boulpaeps Medical Physiology chapter 32 on the "Control of Ventilation" (2012).