Like diacetyl in ales, dimethyl sulfide (DMS) is common in many light lagers and is considered to be part of the character. DMS is produced in the wort during the boil by the reduction of another compound, S-methyl-methionine (SMM), which is itself produced during malting. When a malt is roasted or toasted, the SMM is reduced beforehand and does not manifest as DMS in the wort, which explains why it is more prevalent in pale lagers. In other styles, DMS is a common off-flavor, and can be caused by poor brewing practices or bacterial infections.
DMS is continuously produced in the wort while it is hot and is usually removed by vaporization during the boil. If the wort is cooled slowly these compounds will not be removed from the wort and will dissolve back in. Thus it is important to not completely cover the brewpot during the boil or allow condensate to drip back into the pot from the lid. The wort should also be cooled quickly after the boil, either by immersing in an ice bath or using a wort chiller.
When caused by bacterial infection, DMS has a more rancid character, more liked cooked cabbage than corn. It is usually the result of poor sanitation. Repitching the yeast from an infected batch of beer will perpetuate the problem.