A man opened fire at a Mercedes-Benz factory in southwestern Germany on Thursday, leaving two people dead, the company said.