Diacetyl is a compound generated by the yeast in most beers, and its level or concentration varies by yeast strain and beer style. Most styles should not have any, but a handful of styles allow for a tiny amount. (People's sensitivity to diacetyl varies wildly, so "tiny amount" is subjective.)
Most yeast strains will usually "clean up" the diacetyl if given sufficient time in primary to complete the job. So leaving the beer on the primary yeast cake thru the entire fermentation cycle is key. Additionally, if your yeast strain or beer style recommends a diacetyl rest, it means raising the ferm temp 2 or 3 degrees Fahrenheit towards the end of the active ferm, often in the five to eight day range.
At that stage, the yeast is tired, drunk, and finishing off the more complex sugars and also trying to clean up diacetyl and other typical by-products of the fermentation. Raising the temp slightly helps the yeast with the clean up. Raising the temp may also keep the yeast eating and achieve 1-2 more points of attenuation.