How does a chain get filthy and how can you stop it from getting filthy?
The "filth" is a composite material. It is a mixture of chain lube, road grit, and the metal filings from gear and chain wear. The road grit is composed of sand, tire bits, asphalt, trash, etc. The issue is when you mix them all together it forms a thick, pasty sticky mess.. The goop tends to collect more material. The  grit in the sticky residue acts like sandpaper accelerating wear. You can minimize but not eliminate it by using the correct lube. This generally means a dry type lube when the conditions are dry and a wet lube when the conditions are wet.