The filling of electrons in an atomic orbital takes place from the low energy atomic orbitals to the high energy atomic orbitals. Since according to the(n+l) rule, the greater the value of (n+l), higher will be the energy of the orbital.
4𝑠 orbital have (n+l)=4+0=4
3d orbital have (n+l)=3+2=5
The (n+l) value of 3d is more than that of 4s. So, the energy of 3d is more hence 4𝑠 is filled earlier than 3d.
The principal quantum number (n=3) for 3𝑑 and (n=4) for 4s, 3d experiences greater force of attraction from nucleus because 3d is much closer to the nucleus as compared to 4s which makes it difficult to remove an electron from 3d before 4s.
Hence, the electrons are removed first from 4s rather than 3d as 4s electrons are farther and more loosely held by the nucleus as compared to 3d.