I can give you me thoughts as to what might be going on, but I would recommend making an appointment with an otolaryngologist
(ENT aka Ears Nose Throat) physician to get evaluated. They will be able to take a thorough history, go through your medical records with you, and do a thorough exam which I am obviously not able to do in this forum. In the ENT clinic it is not entirely uncommon to have a patient who has been suffering from CRS (chronic rhino-sinusitis) develop a crust within one of their sinuses, or within the nose itself which can have a foul odor. I don't know if you have chronic sinus problems
, but this may be one explanation. If you have poly disease, or other inflammatory sinus disease that obstructs the normal outflow of mucous in your sinuses, you may also notice a foul smell from the growth of bacteria within the blocked mucous. Lastly, if there is inflammatory disease that is high in the sinuses, along the skull base, it can affect how the olfactory receptors are able to function. In order to smell, small particles are absorbed in the mucous of your nose high along the base of the skull where the olfactory nerve and its receptors are located. I would recommend making an appointment with an ENT to get a thorough examination to see if the etiology of this foul smell can be determined.