How did governments convince the perpetrators who were gulity of mass killings in WWII to do this work?
To some extent, the governments involved in the mass killings of World War II did not have to convince their people to participate in those killings. To the extent that they did have to convince them, it was done through the use of propaganda and, to some degree, fear.
Some of the perpetrators were motivated by long-standing hatreds that were not really caused by any governmental body. For example, there had been a long history of anti-Semitism in Germany (and elsewhere) before WWII. As another example, the ethnic Russians of the Soviet Union were strongly anti-Polish due to ethnic/nationalistic rivalries. Such people did not need much convincing to participate.
Government propaganda helped to push people towards participation in mass killings. The most blatant example of this was Nazi teaching on race. The Nazis explicitly set out to teach their citizens that Jews were out to destroy the German race and that Slavs were subhuman and should be cleared out to make way for ethnic Germans. These teachings helped condition people to be willing to participate in mass killings.
Finally, there was certainly an element of fear involved. In totalitarian states, it is never safe to defy the government. Some people participated in these killings because they were afraid not to.
Thus, the governments persuaded people to participate through propaganda and fear, though there were already prejudices that inclined many to participate without needing to be convinced.