The first answer came out correct because by chance the molar ratio for Al to H in both equations came out to be 1:1. However, notice that the first equation you wrote isn't balanced correctly for mass? So more work needs to be done to get an accurate equation.
The second equation balances the mass on both sides of the equation, but at the same time brings in "outside" knowledge that certain metal ions in period 3 or below have empty d-orbitals that can form complexes with water molecules. You have probably been exposed to this idea already when you solved problems in beginning chemistry that had copper in the molecular formula (remember compounds like CuSO4 . 5H20? It's the same idea here...the water in this case is complexed to the empty D-orbitals in the aluminum ion whereas before they were complexed to the copper ion).
You can actually do an easy experiment with salt since sodium is also in period 3 and forms complexes with water. Heat a metal pie tin on your stove (be careful not to touch the tin during or immediately afterwards until you give it plenty of time to cool down first!), and place some normal table salt on the tin. You will start to hear "popping" as the water molecules get de-attached from the sodium and pop/vaporize out of the salt.
Hope this helped.