The full story is complicated and involves a lot of detail about the way photons interact with electrons and how the atomic binding of the electrons limit those interactions, but the short version is that higher atomic numbers tend to absorb or scatter x-rays more than lower ones. This figure

(copied from the 2012 Particle Data Book it's figure 30.16 in the chapter on passage of particles through matter (PDF-link)) shows the absorbtion length as a function of photon energy for a number of elemental materials. "X-ray" is not a very precise term but we can loosely assign it to the range from less than 1 and a few tens of keV (so left of center on the figure). Notice the log-log scale.
Notice that the units of length here are $\text{g/cm}^2$ or areal density which means that the trend is much more pronounced when converted to length as higher Z materials also tend to be denser.