Put dead simply:
there's a gene that allows the pumping of certain ions into your lungs, which in turn draw water into the mucus that basically lines and protects your respiratory system. The water makes the mucus more runny, so that cells in your respiratory tract can hike it up to let it catch all the nasties that you breathe in-and then you tend to swallow it, taking all of the dust and crap and bacteria down into your stomach where it's rendered harmless.
In CF sufferers, the [CFTR] gene is deformed/mutated so it can't pump the ions in, therefore water can't get into the mucus.
As a result, the mucus stays all treacly, like tar instead of like runny snot

, and it is very difficult for you to get it up and out of the lungs -so this heavy, thick, sticky mucus irritates the lungs, and it traps bacteria and whatnot, so it causes a cough and you're more susceptible to lung infections/bronchitis/pneumonia and whatnot.
Also, the mucus in your pancreatic duct gets all sticky, so digestion is harder, too.
So basically sufferers have a diminished lung capacity, and have to have daily physio so that they can hack up as much of the mucus as possible.