Let $X,Y,Z$ are affine schemes say $X=\rm{Spec}(A), Y=\rm{Spec}(B), S=\rm{Spec}(R)$ and we have morphism of schemes $f: X\rightarrow S$ and $g:Y\rightarrow S$.
These maps $f: \rm{Spec}(A)\rightarrow \rm{Spec}(R), g: \rm{Spec}(B)\rightarrow \rm{Spec}(R)$ gives maps $m:R\rightarrow A$ and $n:R\rightarrow B$ such that corresponding map $m^{\#},n^{\#}$ on spec equals $f,g$ respectively.
We have inclusion maps $i:A\rightarrow A\otimes_R B$ and $j:B\rightarrow A\otimes_r B$.
This gives $i^{\#}:\rm{Spec}(A\otimes_R B)\rightarrow \rm{Spec}(A)$ and $j^{\#}:\rm{Spec}(A\otimes_R B)\rightarrow \rm{Spec}(B)$ $$\require{AMScd} \begin{CD} \rm{Spec}(A\otimes B) @>i^{\#}>> \rm{Spec}(A)\\ @Vj^{\#}VV @VVf=m^{\#}V\\ \rm{Spec}(B) @>g=n^{\#}>> \rm{Spec}(R) \end{CD}$$
To show that $\rm{Spec}(A\otimes_RB)$ is fibered product, we have to prove atleast that the above diagram commutes i.e., $m^{\#}\circ i^{\#}=n^{\#}\circ j^{\#}$, equivalently $(i\circ m)^{\#}=(j\circ n)^{\#}$, equivalently $i\circ m=j\circ n$ i.e., commutativity of following diagram
$$\begin{CD} R @>m>> A\\ @VnVV @VViV\\ B @>j>> A\otimes_R B \end{CD} $$
and I do not see why should this digram be commutative. For $r\in R$ we have $(j\circ n)(r)=1\otimes n(r)$ and $(i\circ m)(r)=m(r)\otimes 1$ and I do not see why these two should be equal.
Help me to understand this better.