Unlike planets orbiting the Sun, electrons cannot be at any arbitrary distance from the nucleus; they can exist only in certain specific locations called allowed orbits. ... The electron travels in circular orbits around the nucleus. The orbits have quantized sizes and energies.
Why do electrons not orbit the nucleus?
Quantum mechanics states that among all the possible energy levels an electron can sit in the presence of a nucleus, there is one, which has THE MINIMAL energy. This energy level is called the ground state. So, even if atoms are in a very very called environment, QM prohibits electrons from falling to the nucleus.
Why are electrons orbiting the nucleus?
All it needs is the electrostatic attraction between the positively-charged protons in the atom's nucleus and the negatively-charged electron. In short, electrical attraction to the nucleus is what keeps the electron in orbit, and this attraction doesn't cost energy.