Let $M$ be a symplectic manifold with symplectic form $\omega$, let $f$ be a smooth function on $M$, and let $X_f$ be the unique vector field on $M$ so that $df(Y) = \omega(X_f, Y)$ for all vector fields $Y$. Does the flow $\phi_t$ generated by $X_f$ preserve $\omega$?
I'm just going to call your vector field $X$. It suffices to show that the Lie derivative $\mathcal L_X \omega = 0$ (do you see why?) To do this, use Cartan's formula for the Lie derivative of a form: $\mathcal L_X \omega = d\iota_X \omega + \iota_X d\omega = d\iota_X \omega$, because $\omega$ is closed; now by your assumption, $\iota_X \omega = df$, and as a result $d\iota_X \omega = ddf = 0$, as desired.