Entropy and gravitational attraction
The collapse of an interstellar gas cloud to eventually form a star, the formation of a planet, and the gravitational differentiation of a planet are all examples of exothermic (heat-producing) processes. As is the case with other exothermic processes, these processes increase entropy.
The cooling of a newly-formed planet has the appearance of an endothermic process. The decrease in entropy as a newly-formed planet cools is more than balanced by an increase in the entropy of the rest of the universe. That cooling is accomplished by radiating energy into space. That radiated energy represents a key concept in a newer understanding of entropy: In many cases, it's better to look at entropy as energy dispersal rather than some fuzzy concept of order versus disorder. The cooling of a newly formed planet is a perfect example of that.