X-rays are done by allowing radiation to penetrate the human body and pass through to the other side. As some organs and tissues absorb radiation more than others (bones absorbing more than others), the radiation doesn't pass through and those areas are white on the film after it is developed (because less radiation reached the film to cause it to turn black). As you state in your question, there is always some risk associated with radiation exposure, specifically the risk of causing cancer or other changes in the rapidly growing cells in the body. For that reason, pregnant mothers are often spared radiation, or at least it is minimized as much as possible (as by using a lead shield to cover your baby). That being said, there are some cases where the exposure to radiation is worth the risk. Some illnesses can be so threatening that a low risk of a future problem (as caused by radiation exposure) is needed to avoid a more serious problem now. Most simple x-rays (not CT scans) provide very limited radiation exposure (roughly equal to what a person would get flying on an airplane), and can be used judiciously. Please speak with your doctor
about your concerns.