When electron hit metal, it slows down. The slowing down will release electromagnetic radiation in the X-ray region called bremsstrahlung (while simultaneously contributing to characteristic X-ray peak)
Lets go through step-by-step. Electromagnetic (EM) radiation can interact with charged particle. For EM wave weaker (lower frequency) than gamma radiation, only the electrons in orbitals will be affected (and no affect on in nucleus).
Photons can cause electrons in orbitals to excite to higher energy level and subsequently return to ground state while -re-emitting the EM wave absorbed. For gases like hydrogen, the highest energy level that it can correspond to is ultraviolet frequency. But since metal contains more orbital configuration, i can achieve higher energy level which corresponds to X-ray frequency.
Inside X-ray tube, you fire electrons at high speed. When it encounters metal atoms, it slows down significantly. This deceleration releases electromagnetic radiation. Since there are a lot of electrons involved and undergoing various deceleration rate, the curve appears continous and smooth. But the high kinetic energy also allows for electrons occupying the lowest energy state in metal atom to be knocked out. This causes electrons at higher energy level to move down until lower energy states gets occupied. This process releases EM wave in the X-ray region which can be viewed in the form of characteristic X-ray peak