The answer lies in the basic but remarkable molecular structure of cotton, nylon and water. The simple water molecule, with its one oxygen atom attached to two hydrogen atoms, causes a different action when it comes in contact with the complex molecules that make up cotton and nylon.
Water has a sticky quality that comes from its molecular structure. The oxygen atom attracts electrons, giving it a slightly negative charge. The two hydrogen atoms have a slightly positive charge. The positive and negative ends make the water molecule like a magnet (dipole), which keeps water molecules together and makes the surface of a water drop slightly elastic. It also means that water molecules will bond easily with molecules with an opposite charge that come nearby.
Cotton and nylon are both made up of giant polymer molecules. Polymer molecules are often long chains of atoms linked in repeating patterns. There are a lot of atoms bonded to one another in these molecules, giving a lot of places where sticky water molecules can find a place to bond.
Cotton is pure cellulose, a naturally occurring polymer. Cellulose is a carbohydrate, and the molecule is a long chain of glucose (sugar) molecules. If you look at the structure of a cellulose molecule you can see the OH groups that are on the outer edge. These negatively charged groups attract water molecules and make cellulose and cotton absorb water well. Cotton can absorb about 25 times its weight in water. Chemists refer to substances like cotton as hydrophilic, which means that they attract water molecules.
Nylon is a synthetic material, meaning that chemists create the polymer molecules that make up nylon. More than 100 repeating units of carbon, oxygen, hydrogen and nitrogen atoms make up the long chain nylon molecule. The strength of the long nylon molecule made it a great replacement for silk, which had a similar feel and texture.
The nylon molecule, too, has a great number of places where it can form bonds with water molecules, but not as many places as the cotton molecule. Nylon absorbs water, but not nearly as much as cotton. It only absorbs about 10 percent of its weight in water.
There are a couple of other things about cotton towels and nylon jackets that help them do what they are supposed to. Terrycloth, the fabric in towels, has lots of loops on its surface. That gives more places for the cotton and water to come into contact. Textile makers add resins and other water-repellant chemicals to nylon so that the water drops will run off rather than be absorbed.
Here are some interesting links: