The white chunks that you cough up are tonsil stones.
The tonsil stones that are coughed up as white chunks are formed by debris which build up in your tonsils.
Most of the tonsil stones are small and are most commonly under 5mm across in size.
Your glands contain folds known as tonsillar crypts.
And if the tonsillar crypts become enlarged then minerals like calcium can then become trapped and then calcify or harden into tonsil stones.
When you cough up thick, solid white mucus, it can be a sign that you have a bacterial infection in your airways.
This type of an infection can sometimes require prescription antibiotics from your doctor to treat.
Tonsil stones smell because the bacteria and fungi feed on the mucus, food, and debris that gets stuck in the tonsil pits.
The anaerobic bacteria produces foul smelling sulfides giving it that distinct pungent smell.
Tonsil stones are also composed of many layers of living microbes.