That idea came from the Bohr theory of the atom. It's good enough for the main hydrogen spectral lines. But in general and to be accurate (except for relativistic effects) you have to solve the Schrodinger equation.
For the Bohr model, Bohr hypothesized a way to get quantized orbits. He postulated a quantized angular momentum as integer multiples of h/2, which led to the quantized values of energy and the discrete orbital shells.
This was later reinterpreted by deBroglie as electrons being matter waves; the idea was relatively simple but revolutionary. Assume the electrons are wavelike, and only if they create standing waves as they orbit can they be stable. Otherwise the wave in one cycle will interfere negatively with the next cycle and so on. That gives you the idea that the orbits have to be integer multiples of the wavelength. From that you get everything else in the Bohr atom. See the Bohr model, with also the deBroglie interpretation, of the atom explained more at https://en.m.wikipedia.org/wiki/Bohr_model
Those started the idea of atomic orbits being quantized. It started with Bohr in 1913 simply hypothesizing that angular momentum came in half integer multiples of h. For deBroglie around 1924 it was that n times the wavelength is $2\pi r$, in deBroglie's model that led to the momentum (which equals h/$\lambda$) being quantized. From either one the energy levels are also quantized.
It takes the Schrodinger equation to solve for the wave functions and energy levels of stationary orbits. Other solutions are not stationary. The ones that are are so called eigenstates of the energy, which is conserved.