Because the energy required to pair the electrons in 4s in this case is higher than the energy required to pair the electrons in 3d. It's all about relative energetics. The 3d and 4s orbitals are pretty similar in terms of energetics and putting electrons into those orbitals changes the relative energies. Electrons will always go to the orbital with the lowest energy first (taking into account pairing energy). It's not useful to memorize the exceptions to the rule though, and you should focus on other things.