About definition of morphisms The following definition is from fulton, algebraic curves.
Let $X$ and $Y$ be varieties. A morphism from $X$ to $Y$ is a mapping $\phi : X \longrightarrow Y$ such that

*

*$\phi$ is continuous

*For every open set $U$ of $Y$, if $f\in \Gamma(U)$, then $f \circ \phi $ is in $\Gamma(\phi^{-1}(U))$.

Here, why we need second definition ? If $f$ is a function on $U$ then clearly $f \circ \phi$ is well defined on $\phi^{-1}(U)$. If this condition is needed, then how can I show some functions are morphism? For example, what should I check to prove the statement, like

composition of morphisms is morphism

 A: The best answer to this question naturally depends on your background. In manifold theory (or simply multivariable calculus) a map between manifolds $f:M\to N$ is smooth if it is locally smooth. That is, taking local coordinates $(U,p)$ and $(V,f(p))$, we say $f$ is smooth at $p$ if the induced map $\widetilde{f}:U\to V$ is smooth.
Now, this is in turn equivalent to requiring that for any function $g\in \mathscr{C}^\infty(V)$, $f^*(g)=g\circ f$ lies in $\mathscr{C}^\infty(U)$. That is, the pullback of a smooth function is smooth.
Indeed: suppose that $f:U\to V$ is smooth in the typical sense (i.e. component functions are smooth functions). Then, by basic theory of manifolds we know that composition of smooth maps is smooth so that for any $g\in \mathscr{C}^\infty(V)$, $g\circ f$ is again smooth.
Conversely, if $f$ pulls back all smooth functions to smooth functions, then take the coordinate functions $(y^1,\ldots, y^n)$ on $V$. Then $y^i\circ f=f^i$ is smooth for each $i$. As a consequence, $f$ is smooth.
So, this really is a natural condition. It turns out that in the algebraic case you can show that a map of affine varieties $f:\Bbb{A}^n_k\supseteq X\to Y\subseteq \Bbb{A}^m$ is regular if and only if each of the $f^i:X\to \Bbb{A}^1$ is regular. Hopefully this convinces you that this notion of "regular" map is the correct one.
To answer your second question about why we want to require this, it is essentially that we want to deal with morphisms that will respect the structure we place on our varieties. We do not want to consider arbitrary functions, so we do not want our map $f:X\to Y$ to pull back regular functions to "ordinary" functions. For instance, what if we had a morphism $f:\Bbb{A}^2_k\to \Bbb{A}^2_k$ so that the first coordinate function pulled back to an arbitrary function? Then we would have that $f=(f_1,f_2)$ where the components are "set theoretic functions." This is not intuitively what a regular map should be. It does not behave algebraically with respect to the coordinates whatsoever.
This definition of regularity that you are using is especially well suited to proving that compositions of regular morphisms are regular. For instance, let $f:X\to Y$ and $g:Y\to Z$ be regular morphisms of algebraic varieties. Take an open $U\subseteq Z$ and a regular function $\alpha\in \mathcal{O}_Z(U)$. Then $g^*(\alpha)=\alpha\circ g\in \mathcal{O}_Y(g^{-1}(U))$ by definition of $g$ being regular. Then $f^*(g^*\alpha)=\alpha \circ g\circ f=(f\circ g)^*(\alpha)$ is in $\mathcal{O}_X(f^{-1}(g^{-1}(U))=\mathcal{O}_X((g\circ f)^{-1}(U))$ which implies that $g\circ f$ is regular.
