X-rays are produced when -
High-Yield Explanation
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.