Diacetyl is sometimes a common flavor in some ale yeast strains (notably ringwood ale yeast), but for the most part it's a flaw. A couple of causes are stressed yeast and infection like mentioned.
Underpitching of yeast, and variations in temperature can cause it, as can cold crashing too soon. I don't know if two months in the primary can cause it, although it could. Lack of aeration could definitely cause diacetyl production, and can too-high fermentation temperatures (again, a stressed yeast reaction).
Normally, the yeast create diacetyl as a byproduct of fermentation. Some yeast strains are especially prone to this and usually after active fermentation is done the yeast will go back and digest some of their own waste products like diacetyl. But if the yeast is underpitched, it may be too worn out to go back and finish up the "clean up" so to speak. Fermentation temperatures are generally raised right at the tail end of fermentation, to encourage the yeast to finish up and get to the FG and then clean up any diacetyl. If the fermenter got cold at that time, it would inhibit this process.
I've never left a beer in the primary for two months, but in theory that could be a factor as diacetyl is a byproduct of yeast activity. Some English strains have notable diacetyl production, and I've had issues with it in some lager strains and even a hybrid lager strain (San Francisco lager yeast).