Here is the Yoneda embedding:
$\mathscr{C} \xrightarrow{y} \operatorname{Func}(\mathscr{C}^{op}, \mathscr{S}et)$ where $$y(f: X \to X') = (\mathscr{C}(-, f):\mathscr{C}(-, X) \to \mathscr{C}(-, X'))$$
I was trying to prove that it preserves identity but I do not know exactly what is $y(X)$ as $y$ should act on a function not a set. Could someone explain this to me please?
The object $X$ is mapped to the functor $\mathscr{C}(-,X)\colon \mathscr{C}^{\rm op}\to \mathscr{S}et$ that sends objects $Y$ to the Hom-set $\mathscr{C}(Y,X)$ and sends morphisms $u\colon Y\to Z$ to the set map $\mathscr{C}(Z,X)\to\mathscr{C}(Y,X)$ obtained by "precomposition with $u$".
The embedding sends a map $f\colon X\to X'$ to the natural transformation between $\mathscr{C}(-,X)$ and $\mathscr{C}(-,X')$ that is defined by taking morphisms into $X$ and post-composing with $f$ to get morphisms into $X'$.
Thus, $\mathrm{id}_X$ is mapped to the natural transformation between $\mathscr{C}(-,X)$ and itself corresponding to "post-composition with $\mathrm{id}_X$".
Work out what that means and verify that this is indeed a natural transformation and that it is none other than the identity natural transformation.