X-rays are produced when -
Electron beam strikes the nucleus of the atom
Electron beam strikes the anode
Electron beam reacts with the electromagnetic field
Electron beam strikes the cathode
When electrons from cathode strikes the anode , X rays are produced but also there is large amount of heat production and hence tungsten having high melting point(3360c) used as a target material.
Fundamentals in Radiology