We know that, oxidizing agent undergoes reduction and reducing agent undergoes oxidation. Hence, we need to know whether the substance has undergone oxidation or reduction. As X undergoes a chemical change by losing hydrogen atom, it undergoes oxidation. Hence, it is a reducing agent. To the product Y, hydrogen is added, it undergoes reduction. Hence, Y acts as an oxidising agent.