This is a cutaway drawing of the proposed structure of Ganymede's interior.
Click on image for full size
As the formation of the planets came to an end, some planets as well as some moons turned inside out! That's right. With all the bombardment by leftover debris, the proto-planets and proto-moons warmed up. Heavy material such as iron, which was part of the material which came from the primordial nebula to form the planets or moons, fell to the center as soon as the planet became warm enough, thus forming a planet's core. The term for this process is differentiation
, which means "to separate into layers".
This is page 21 of 60