When a TM ion is dissolved in water it will form a hexaaquo complex ion. Six water molecules acting as lizards will form dative bonds to suitable receptor orbitals on the cation. This has an effect on the energies of the d set of orbitals. Due to their profiles, and the octahedral geometry of the complex ion, their gas-phase degeneracy is lost; three fall to a lower energy level and two move to a higher level. This means that an energy seperation exits between these two sets. The d electrons are fed into these orbitals, filling up from low level as usual.
An electronic transition from low level to high level requires the absorption of some energy, and it so happens that the energy seperation corresponds to energy carried by photons of visible readiation. So, if the red end of the white light spectrum is absorbed by electron excitation, the ion will appera blue. The complementary colour is seen.
PLEASE do not reply as one candidate did one year : "The electrons get excited and jump up and down." They are NOT small children who have just heard that they are going to McDonalds for tea!