Using plane wave pseudopotential methods based on density functional theory, the unit cell volumes, the electronic densities of states, the bond orders, the charge populations, and the formation enthalpies of Mg2-xAlxNiH4 (x=0, 0.125, 0.25) alloys were calculated. By analyzing atom bonding and structural stability, the effects of partially substituting Al for Mg on the structure and hydrogen storage property of the alloys and their hydrides were investigated. It was shown that the unit cell volume of the Mg2Ni alloy decreases with the increase of Al content; the decreased unit cell volume hinders the incorporation of hydrogen atoms, thus reducing the hydrogen storage capacity. For Mg2-xAlxNiH4 (x=0, 0.125, 0.25) hydrides, the Mg-H and Al-H interactions are much weaker than the Ni-H interaction. However, the Ni-H interaction is weakened and the hydride enthalpy of formation decreases with increased Al content. Although the stability of the hydride structure is weakened, hydrogen desorption kinetics-for the Mg2Ni hydride can be improved with the partial substitution of Al for Mg.