If you get confused by the mole concept, realize that it is, at its most basic, just a way to conveniently measure amounts of atoms or molecules, which are usually very large numbers in every day practice. Just as you would not express or measure the distance between here and the moon in inches - although you could, if you so chose - you would not count or express the number of molecules in a glass of water. Rather, you would say the glass contains so many milliliters - or grams - of water. "Moles" is a way to connect the mass of a macroscopic substance to the number of individual microscopic elements in the substance.
Getting to your question: rather than asking how many moles of Mg reactive with molecules of oxygen, it may be easier, though equivalent, to ask how many atoms of magnesium reactive with every molecules of O2. The question does intentionally try to throw you off by using O2, each molecule of which contains two oxygen atoms. Don't get fooled. The discrete unit in question here is an oxygen molecule. According to the equation given, how many atoms of magnesium are required to react with each molecule of oxygen gas?