The electronic structure of LaNi5 and its hydride LaNi5H7 are obtained using the self-consistent cluster-embedding calculation method. The Fermi level of LaNi5H7 is 5.172 eV higher than that of LaNi5. In both materials, the La 5d electrons locate nearby the Fermi levels, and make only a small contribution to the density of states (DOS) of the valence bands. There is no significant charge transfer from La to Ni in LaNi5. But for LaM5H7, there is a charge transfer of 1.16 electrons from La to H, and H atoms are combined mainly with Ni to form hybridized orbitals in the energy regions far below the Fermi level. An explanation of hydrogenation of LaNi5 is proposed: It is easy for hydrogens to take off some localized La 5d electrons near the Fermi level, and combine with Ni to form hybridized orbitals in lower energy regions. This process is therefore-in favor of energy, and forces a lattice expansion until the Fermi level rises to zero.