Center of gravity is the point in a body around which the resultant torque due to gravity forces vanish. Wikipedia
The center of gravity of any given rigid body (like a barbell) is fixed. For objects with movable components, like sandbags or water bottles the centre of gravity can move. Note, that while the centre of gravity of a barbell will be approximately in the centre of the bar, when you unevenly load it this point will shift, but only because the new system (bar + weights) will have a different centre of gravity.
Changing where you place your hands on a barbell or dumbell does not change the centre of gravity. If one were so inclined you could find the approximate centre of gravity of a barbell by
But this doesn't explain why barbells and dumbells are so physically different. The reason objects become unstable is a factor of their centre of gravity and their stable base, both of which impact the objects equilibrium.
Barbells and stable equilibrium
Below left we see an illustration of a bench press (although the same applies to any barbell movement). The blue dot is the centre of gravity of the barbell, and the base on which it rests is the lower body. We can consider this bench presser as an object which is in a state of stable equilibrium. On the right we see a ball in stable equilibrium, any movement in any direction will move it, but it will return to a stable point. Much like our bench presser who has a large amount of leeway in movement before the centre of gravity of the barbell moves out of the base. This makes the barbell easier to control.
Dumbbells and unstable equilibrium
Contrast this with the below dumbell bench presser, each dumbbell has its own centre of gravity. Although there are two shown, this is to eliminate issues of counter balance, and we will consider only a single dumbbell. Where the base for an individual dumbell is is tricky to determine, but if we consider it to be either the shoulder, the elbow or the hand, the main point is that it is much smaller than the base when holding a barbell. As such, we can consider it like the body below in unstable equilibrium. As such it requires much greater effort to keep the weight within the base to prevent the system (and the exercise) from failing.
Why is this important for fitness?
Because this question is bordering on off-topic, I'll address why this is of importance to people who lift. Most exercises can be made more difficult by reducing the base on which the activity is done, for example:
- Barbell bench press vs Dumbell bench press
- Barbell squats vs single leg squats
- Push-ups vs One-handed push-ups
In each of these examples, the latter is performed with weight distributed across a much smaller base (if we consider the dumbell bench press to be two independent systems). As such, effort goes less into performing the basic movement, and to a larger degree in stabilising the body to ensure the weight is distributed above the base.
This is in part why dumbbell movements seem more difficult than barbell equivalents, as more minor muscles are needed to ensure proper control of the weight, which in turn leads to additional stresses on the neural system. This also help explain some of the advantages to the dumbbells in training and recovery.