The most familiar use of x-rays is checking for fractures (broken bones), but x-rays are also used in other ways. For example, chest x-rays can spot pneumonia. Mammograms use x-rays to look for breast cancer.
X-rays can easily penetrate through material comprised of light atoms, such as flesh. They get absorbed by heavier atoms, such as metals. A beam of electrons of high energy crashes into a target metal which results in the production of x-rays.