The chemical reactions and pathways involving nylon, a polymer where the main polymer chain comprises recurring amide groups; these compounds are generally formed from combinations of diamines, diacids and amino acids.