Because according to Aufbau's principle,electrons get filled in the increasing level of energy of the orbitals, after 3p, among 4s(n+l=4) and 3d(n+l=5) energy of 4s is lower due to lower (n+l) value, therefore electrons tend to fill in the 4s orbital first.