Just like humans, plants consist primarily of water and carbon compounds, also called organic compounds. Nearly all organic compounds also contain hydrogen atoms, which is why plants need the hydrogen they obtain from water molecules through photosynthesis.
Photosynthesis is a complex process, but is easier to understand by representing it as a simple chemical equation, where six molecules of CO2 (carbon dioxide) and six molecules of H2O (water) are turned into one molecule of C6H12O6 (a simple sugar called glucose) and six molecules of oxygen. The molecule of glucose is composed of oxygen and carbon from the carbon dioxide molecules and hydrogen from the water molecules consumed during the process.
Plant cells use sugars for energy and also as an ingredient for the biosynthesis of other compounds they need, like amino acids and nucleotides for DNA. The hydrogen atoms from the glucose become incorporated into other organic compounds through these processes. All important biomolecules like DNA, RNA, lipids or fats, sugars and carbohydrates include hydrogen atoms.
Plants obtain the hydrogen they need from water molecules. Don't try to feed your plant hydrogen gas -- your plant wouldn't know what to do with it if you did. As long as they have water, plants can readily obtain all the hydrogen they need.