We determine the magnetic properties of individual Co atoms adsorbed on graphene (G) with x-ray absorption spectroscopy and magnetic circular dichroism. The magnetic ground state of Co adatoms strongly depends on the choice of the metal substrate on which graphene is grown. Cobalt atoms on G/Ru(0001) feature exceptionally large orbital and spin moments, as well as an out-of-plane easy axis with large magnetic anisotropy. Conversely, the magnetic moments are strongly reduced for Co/G/Ir(111), and the magnetization is of the easy-plane type. We demonstrate how the Co magnetic properties, which ultimately depend on the degree of hybridization between the Co 3d orbitals and graphene p bands, can be tailored through the strength of the graphene-substrate coupling.