Before I give you my answer, here are a few other answers that will give you some insight:
Why do electrons occupy the space around nuclei, and not collide with them?
What prevents an atom's electrons from "collapsing" onto its protons?
Why don't electrons crash into the nuclei they "orbit"?
How does quantum mechanics explain stability of electron orbitals?
Where did Schrödinger solve the radiating problem of Bohr's model?
Quantum mechanics,and how the law $ΔxΔp≥ℏ/2$ explains the paradox regarding atoms
How does an electron move around in an orbital? Is it "wave-like" or random?
These answers all have some pieces of answers to your question, but they do not explicitly give you a very understandable simple answer.
I am going to try to explain this to you with my own words, but pieces of these ideas also might appear in the other answers.
I am NOT trying to copy or cite anything pretending it would be my own discovery (I had been warned in the past). All of these ideas have already been addressed on this site, but only pieces of it are together. But I believe that the specific answer to your question needs to be addressed fully in one simple understandable answer.
OK I will try to give you a very easy to understand way with my very simplistic words:
- Anna V is of course right that
"conservation of energy holds also in the quantum states. The electron around the nucleus is in a quantized energy level and can
change it only if an external interaction intervenes."
I believe that you are asking whether what is it (what effect or what force) that holds the electron in this "quantized energy level".
"the electron is constantly interacting with the nucleus via "virtual particles/photons" and the opposite electric charge of the nucleus creates a force that attracts the electron towards the nucleus."
the position of the electron is described by it's wavefunction, and that gives you a 'cloud' around the nucleus with the probability distribution of where you will find the electron.
This cloud will then 'limit' the electron's position into a somewhat spherical 3D location around the nucleus.
Heisenberg's uncertainty principle states that
"we cannot know the position and the momentum of the electron better
then to a certain limit at the same time."
If the electron would 'move' to a lower orbit, so then it's 'cloud' would limit it into a smaller space around the nucleus. But because of 4. this is only possible if it's momentum will be known with lesser certainty, that is, it's momentum will have higher probabilities at bigger momenta, and that will increase the momentum of the electron at the same time as it's position 'shrinks'.
So this increasing momentum will keep the electron away from the nucleus. It is (or it can be thought of as one very simplistic way to understand) the balance of the two effects that will create this "quantized energy level".