Center of mass
The center of mass is the average position of all the parts of one system, weighted according to their masses. Take the example of an apple. An apple has many parts, the leaf, the peel, the seeds, etc. Consider the weight of all these parts and try to describe their distance from one point in the center. This point is the unique position at which the weighted position vectors of all the parts of a system sum up to zero. The position of the center of mass has units of meters. There does not have to be any actual material from the object at the center of mass. Consider the case of a donut; the center of the mass is located where the hole is in the middle, or the case of a balloon, where the center of mass is in the middle where only air exists.
Figure 1: The center of mass of an apple.
Center of gravity
In many equilibrium situations, one of the forces acting on the body is its weight. In free-body diagrams, the weight vector is attached to the center of gravity of the body. The center of gravity and the center of mass may be located at different points only in situations where a body is so huge that the gravitational field is non-uniform throughout its volume. In practical situations, however, even objects as large as buildings that are located in a uniform gravitational field on Earth’s surface, the center of gravity is identical to the center of mass.
Figure 2: The center of mass and gravity in a uniform and non-uniform field.