A dielectric is an insulating material that increases capacitance when placed between capacitor plates. Dielectric constant K = >= 1. Two scenarios must be distinguished:
Battery connected (V constant): Inserting dielectric increases C by K. Since V is fixed, Q = CV increases by K. E = stays the same. Energy U = \frac{1}{2}$$CV^2 increases by K. Extra energy comes from the battery.
Battery disconnected (Q constant): C increases by K. V = decreases by K. E = decreases by K. Energy U = Q^ decreases by K. Lost energy goes into pulling the dielectric in (or is released as work).
The dielectric is pulled into the capacitor in both cases — this is because the system moves toward lower energy (battery off) or the battery supplies energy to increase the charge (battery on). Force on dielectric slab (partially inserted, battery on): F = (K-1) / L, where L is the plate length.