Answer:

Step-by-step explanation:
Magnesium (
) and chlorine (
) combine to form an ionic bond. Ionic bonds means that atoms ionise and give/take electrons from each other. So when writing the compound you will "swap" the charges (the 2 from Mg becomes the number of Cl needed to balance)
Mg goes first because it's a metal and the metal should be written first.