If $Y$ is a regular function of $X$, $(X,Y)$ cannot have a density since $(X,Y)$ is always on the graph of the function, which has measure zero. But you should not use this to compute the distribution of $Z$ a function of $X$.
Rather, you could use the fact that $Z$ has density $f_Z$ if and only if, for every measurable function $g$,
But, if $Z=h(X)$, $E(g(Z))=E(g(h(X)))$, and by definition of the distribution of $X$,
where $f_X$ is the density of $X$. In the end, you know $h$ and $f_X$ and you must make the two expressions of $E(g(Z))$ coincide for every function $g$, hence a change of variable I will let you discover should yield an expression of $f_Z$ depending on $f_X$.