When I wake up in the morning, my mouth is filled with foul-smelling sputum. What is this a symptom of?

Probably nasal. Likely a post nasal drip. If you have chronic sinus issues , it is probably related to that. Allergies might produce the same drip. Your mouth secretions can be "ropy" (kind of like stretched pizza cheese), but generally not foul smelling, and usually you would swallow them while sleeping. If no sinus/cold/allergy issues, then see an oral medicine specialist.