New evidence shows that the ability was due to plasmids [e.g. K. Kato, et al., A plasmid encoding enzymes for nylon oligomer degradation: Nucleotide sequence analysis of pOAD2, Microbiology (Reading) 141(10):25852590, 1995.] In fact, more than one species of bacteria have the ability, residing on plasmids. This suggests that the information probably already existed, and was just passed between different types of bacteria.
All that would be needed to enable an enzyme to digest nylon is a mutation causing loss of specificity in a proteolytic (protein-degrading) enzyme. This may seem surprisinghow would a loss of information create a new ability? Answer: enzymes are usually tuned very precisely to only one type of molecule (the substrate). Loss of information would reduce the effectiveness of its primary function, but would enable it to degrade other substrates, too. Since both nylon and proteins are broken down by breaking amide linkages, a change in a proteolytic enzyme could also allow it to work on nylon. If this process were continued, the result would be a general enzyme with a weakly catalytic effect on the hydrolysis of too many chemicals to be useful where much selectivity is required. To put it into perspective, acids and alkalis also catalyze many hydrolysis reactions, but they also lack specificity. Indeed, an inhibitor of a protein degrading enzyme also inhibits the action of the nylon degrading enzyme.
The principle is explained (for a different example) in the book Not By Chance by Israeli biophysicist Dr Lee Spetner. Yet another example of a defect being an advantage, but totally irrelevant to evolution.