First, I would note that if $\displaystyle \begin{align*} z = x + \mathrm{i }\,y \end{align*}$ then $\displaystyle \begin{align*} z^2 = x^2 - y^2 + \mathrm{i }\left( 2\,x\,y \right) \end{align*}$, so $\displaystyle \begin{align*} x^2 - y^2 = \mathcal{R} \left( z^2 \right) \end{align*}$ and $\displaystyle \begin{align*} 2\,x\,y = \mathcal{I}\left( z^2 \right) \end{align*}$.
Next, notice that $\displaystyle \begin{align*} \sin{ \left( X + \mathrm{i}\,Y \right) } = \sin{(X)}\cosh{(Y)} + \mathrm{i}\cos{(X)}\sinh{(Y)} \end{align*}$, so it would suggest that $\displaystyle \begin{align*} X = x^2 - y^2 = \mathcal{R} \left( z^2 \right) \end{align*}$ and $\displaystyle \begin{align*} Y = 2\,x\,y = \mathcal{I} \left( z^2 \right) \end{align*}$.
Thus, we can conclude that $\displaystyle \begin{align*} f(z) = \sin{ \left( z^2 \right) } \end{align*}$.