Why elements with high atomic mass (like tungsten) are used in the production of X-rays, in the Cathode-Ray Tube?
If a sample containing a particular element is irradiated (e.g. with photons or, in case of an X-ray tube, with electrons) with an energy high enough to excite inner electron orbitals, X-rays are emitted in the de-excitation. In contrast to the continuous bremsstrahlung energy spectrum, the energy liberated in the transition from the excited to the ground state takes the form of a characteristic X-ray photon whose energy is given by the energy difference between the initial and final states. If the temporary vacancy has been created in the K shell of an atom, then a characteristic K X-ray is liberated when that vacancy is subsequently filled. In particular, if the concerned electron comes from the L shell, than a Kα photon is generated whose energy is equal to the difference in binding energies between the K and L shells.

The K-series X-rays are generally of most practical importance because their energy is greatest. Their energy increases regularly with atomic number $Z$ of the element, for example, only about $1\ \mathrm{keV}$ for sodium ($Z=11$) and about $100\ \mathrm{keV}$ for uranium ($Z=92$). An empirical law concerning the characteristic X-rays that are emitted by atoms is expressed by Moseley’s law.

Hence, in order to produce characteristic X-ray photons with a high energy, K-series X-rays of a heavy element are preferred.

Since only a small fraction of about $1\ \%$ of the energy generated in an X-ray tube is actually emitted as X-rays and the rest of the energy is released as heat, the temperature of the anode target can be very high during the operation of the X-ray tube. Therefore, the anode has to be made of high-temperature materials. You already mentioned the high melting point of tungsten ($Z=74$); whereas for example the heavier elements lead and bismuth cannot be used because of their low melting points.