Example. Time-dependent gravitational acceleration ($H=E$ but $\dot E \neq 0$)
Consider a particle falling under the influence of gravity near the surface of a large, spherically symmetric planet. Suppose that the mass of the planet changes with time, so that the acceleration due to gravity near the surface is some function $g(t)$ of time. Then the Lagrangian is
$$
L(t, z, \dot z) = \frac{1}{2}m\dot z^2 - mg(t)z
$$
then the canonical momentum conjugate to $z$ is
$$
p_z = \frac{\partial L}{\partial\dot z} = m\dot z
$$
and the Hamiltonian is
$$
H = p_z\dot z - L = \frac{p_z^2}{2m} +mg z
$$
Notice that in this case $H(t) = E(t)$; the Hamiltonian is equal to the total energy. Now, in this case, the equations of motion are
$$
\dot p_z(t) = -mg(t)
$$
So for any solution $z(t)$ to the equations of motion, we have
$$
\dot E(t) = p_z\dot p_z + m(\dot gz + g\dot z) = p_z(\dot p_z + mg) + m\dot g z = m\dot g z\neq 0
$$
Total energy is not conserved, it changes as a function of time due to the fact that the gravitational acceleration depends on time.