Want to see a high school physics teacher sweat? Ask this question.
Electrons were once thought to orbit a nucleus much as planets orbit the sun. That picture has since been obliterated by modern quantum mechanics. But since quantum mechanics confounds even seasoned physicists, the image persists as a useful analogy. Like gravity acting on planets, an electromagnetic force attracts the orbiting electron to the nucleus. Classical physicists wondered that the electron didn't run out of energy.
Niels Bohr solved this mystery by introducing quanta, discrete energy states in which electrons may stably persist. Think of an elevator that only stops at discrete floors (i.e. not between them). And just as an elevator won't take you below the basement, there's a minimum state below which the electron simply cannot fall. Strange as it sounds, the Bohr model is actually much too simplistic, and has since been replaced by even weirder portraits of the atomic world. I'll leave those for your poor physics teacher to tackle.