Electrons don't spiral into the nucleus because they're only allowed in certain orbits
Classical physics said an orbiting electron should radiate energy and crash into the nucleus in an instant, which plainly doesn't happen. In 1913 Niels Bohr proposed that electrons can only occupy specific discrete orbits and jump between them instantly, absorbing or emitting exactly the right burst of light. The model correctly predicted hydrogen's line spectrum and won him a Nobel Prize.
— Niels Bohr, On the Constitution of Atoms and Molecules — Philosophical Magazine, 1913