We haven't really learnt to calculate energy levels.I kinda came up with an answer :- the electrons occupy the 4s orbital first with opposite spins since only 2 electrons can fit into 4s orbital,and it's much more stable than singally occupying the 3d orbital.And when 4s is filled,the effective nuclear attraction is more on 4s than on 3d so it's below 3d,so it's closer to the nucleus..It was a total guess,i don't think it's anywhere near precise.