Magnetic quantum dots in two-dimensional band and topological insulators are studied by solving the modified Dirac model under nonuniform magnetic fields. The Landau levels split into discrete states with certain angular momentum. The states splitting from the zero Landau levels lie in the energy gap for topological insulators but are out of the gap for band insulators. It is found that the ground states oscillate between the spin-up and spin-down states when the magnetic field or the dot size changes. The oscillation manifests itself as changes of sign and strength of charge currents near the dot's edge.