In the generation of X-Rays, why the incoming electron generated from anode knocks out the K shell electron rather than outer shell electrons? When the high energy beam of particles or photon hits the cathode, electrons from $K$ shell are knocked in the generation of characteristic x-rays. Why do inner electrons get knocked out?
 A: There is a probability that any of the electrons are knocked out.

However only the most energetic photons resulting from electron transitions would be classed as being in the X-ray part of the electromagnetic spectrum.
If the charge on the nucleus is low, eg for a hydrogen atom, the transitions to the inner most energy levels result in the emission of UV photons.
A: Well, The story begins by the physicist C. Barkla. He noticed that atoms appeared to emit two types of X-rays. The two types of X-rays differed in energy and Barkla originally called the higher energy X-ray type A and the lower energy X-ray type B. He later renamed these two types K and L since he realized that the highest-energy X-rays produced in his experiments might not be the highest-energy X-ray possible. He wanted to make certain that there was room to add more discoveries without ending up with an alphabetical list of X-rays whose energies were mixed up. As it turns out, the K type X-ray is the highest energy X-ray an atom can emit. It is produced when an electron in the innermost shell is knocked free and then recaptured. This innermost shell is now called the K-shell, after the label used for the X-ray. So, you can say that the question that why accelerating electron coming in didn't hit the outer shell, is not an appropriate statement. You must ask why, when the electron hits the innermost shell(K-shell) produces maximum energy X-ray.
A: Interactions of electrons with atoms needs a quantum mechanical formulation, classical electrodymics, where bremsstrahlung and synchrotron radiation  of X-ray energies can be modeled is not enough to model X-rays from atoms. As Farcher shows in another answer the quantized nature of the energy levels of the electrons have to be taken into account.
In a rough way, an electron has a probability of scattering off the electron orbitals of an atom by exchanging a virtual photon , losing momentum and energy in ejecting the electron. Then that level is filled again giving off the characteristic spectrum of the energy level the bound electron had occupied.

Why do inner electrons get knocked out?

All have a quantum mechanical probability to be knocked out but it is only the inner energy levels that have enough energy to be in the X-ray range.
The same if it is a photon that ejects the K shell electron, it has to have enough energy to do that ( in a type of compton scattering) so that the deexcitation gives off the characteristic -ray.
