Phlegm is a thick secretion of mucous. It's hard to sleep when you have a bad cold and your throat is full of phlegm.
Your body's respiratory system creates phlegm, pronounced "flem," which becomes thicker and more annoying when you're ill. The thick substance you cough up when you have a terrible cold is phlegm. We don't talk about phlegm all that often these days, but it was very important in medieval science — it was thought that too much phlegm led to apathy and laziness, and it was a sign that the body was out of balance.