Okay, I'll try to explain it. Are your concepts of potential energy, work and forces clear? If not then you should look into them. Whenever I have to understand something related to potential energy, I try to relate the system to a mass-earth system and think of gravitational potential energy ( because gravitation is very intuitive to us), so I'll use that to explain the idea behind the formula.
In the case of capacitors, the parallel plates and the dielectric form the system. There are no frictional forces and no external forces ( we want the force b/w the plates and the dielectric slab). The total potential energy associated with this system is U=(1/2)*CV^2.
Now think about a mass-earth system. The mass is at some height H and the potential energy of the SYSTEM is mgH ( we know mgh is only an approximation, but this will do for this discussion). mgH is the potential energy of the whole system, NOT of a single body. When you change the configuration of the system (I.e, change the height of the mass) then the potential energy of the system also changes, let's say it becomes mgH'. Now, the gradient of this potential energy (gradient is how U changes with distance x) gives us the force exerted ON a body.
The forces in both the bodies are equal in magnitude (Newton's 3rd law), this fits perfectly. Can you see that both the forces ( on mass due to the Earth and vice versa ) come from dU/dx .
Coming back to our capacitor system, the same thing happens. The gradient of U gives the force on the dielectric. (Of course the dielectric is also pulling the plates with an equal force)