Roughly speaking, the center of mass has to do with finding a point in a mass or system of masses where F = MA applies. The center of gravity has to do with finding a point where a mass can be suspended at any angle without any tendency for it to twist "by itself".
Imagine a box moving through "empty space". Inside the box is a complicated system of masses connected by springs. The massing are oscillating in various ways. There are no external foces on the outside of box.
Newton's law F = MA applied to a single mass says that there is no acceleration when there is no force. So a single mass, not acted upon by external forces, has a constant velocity. Does this law apply to the box, which contains moving masses that have changing velocities?
To an observer on the outside of the box, it may appear that the box is wiggling around. But we can find a geometric point within the box such that this single point is moving in a straight line with a constant velocity. This point will be the center of mass. The law F = MA applies if we consider all the masses to be concentrated at that point and measure the velocity of that point.
As another example of the center of mass, you can probably find videos on the web that show a dumbell moving through space and rotating. The center of mass of the dumbbell moves in a line even though the ends of the dumbbell don't.
Suppose (on the surface of the earth) you are trying to mount an irregularly shaped obect on an axel so you can spin it around "smoothly". To test whether you have put the axel in a good location, you can turn the object to various angles on the axel and see it will stay balanced at that angle or whether till will turn of its own accord. The point that is the "center of gravity" of the object has the property that if you use an axle that passes through it, the axle will work perfectly for balancing the object and the object will stay balanced no matter at what angle you set it.
If we are dealing with distances in the solar system and objects as large as planets and stars, they may have no "center of gravity". If you can imagine putting a planet on an axel and trying to balance it verus its attraction to the sun, there may be no perfect position for the axle. This is because gravity at this scale does not cause a constant force at each point on the planet. Near the surface of the earth, gravity causes roughly a constant effect at each location. Hence we can "balance" automobile tires.
Planets may not have a center of gravity, but they do have a center of mass.