Why density at different depths change?

Because of the weight (pressure) of all the stuff above pressing down. For solids this results in hardly any change in volume, and for liquids just the same. But for gases, such as the atmosphere, it has a large effect so that at 100miles or so above the earth, air prsssure and therefore density is practically zero.