Please explain how they are different, I am not able to follow this(see bold text below)
Definition. The identity function on the set $X$ is the function $$ i d_{X}: X \longrightarrow X, \quad x \longmapsto x, $$ which we also write as $i d_{X}(x):=x$. The domain and co-domain must coincide for the formula $f(x)=x$ to specify an identity function.
DEFINITION. If $X$ is a subset of $Y$, then the inclusion map is $$ i_{X}^{Y}: X \longrightarrow Y, \quad x \longmapsto x, $$ which we may also write as $i_{X}^{Y}(x):=x$. It is often denoted simply by $i$ when the context makes the domain and co-domain clear. This provides a characterisation of subsets using functions.
We can now construct an example of two functions with the same domain and taking the same values without being the same function.
EXAMPLE Let $X$ be a proper subset of $Y, X \subset Y$, then the two functions $$ \begin{aligned} i d_{X}: X \longrightarrow X, & x \longmapsto x \\ i_{X}^{Y}: X \longrightarrow Y, & x \longmapsto x \end{aligned} $$ have the same domain and are given by the same formula, whence they have precisely the same image. Yet they are different functions, even though the only difference between them lies in the values they do not take.