You can write $Y$ as the image of 1-form as long as $Y$ meets each fiber of $T^*M\to M$ exactly once and this transversally. For a short time this is so (locally on $M$ if you move the image of a closed one-form by a Hamiltonian flow or even a symplectic flow (this is a smooth curve in the group of symplectic diffeomorphisms). If you look at $M=\mathbb R$, symplectic flows on $T^*M$ are just volume preserving flows on $\mathbb R^2$, and you easily see that one can deform $X$ so that it becomes vertical or a curve meandering wildly, and you can do that faster as you go to $\infty$ on $\mathbb R$, so that at no time $Y$ is still the graph of a 1-form (closed plays no role here, since all 1-forms are closed.  

Even if $Y$ stays the graph of a form, the de Rham cohomology class is not constant:
Take $M=S^1$ then $T^*M$ is a cylinder, and you can move $X$ just up, which increases the integral, thus the cohomology class.