As I said in the comment, you are thinking that the stalks of $f_*\mathcal{O}_Y$ coincide with the stalks of $\mathcal{O}_Y$. This is cleary not true in general since direct image functor is not exact unless you assume that $Y \longrightarrow X$ is an immersion.
Let $\mathfrak{p} \in \operatorname{Spec}(A)$ be an arbitrary point, of courser we shall check that the corresponding morphism
$$A_{\mathfrak{p}} \longrightarrow (f_*\mathcal{O}_Y)_{\mathfrak{p}}.$$
The problem is to compute the RHS. It can be done as follows.
$$(f_*\mathcal{O}_Y)_{\mathfrak{p}} = \operatorname{colim}_{\mathfrak{p} \in U} \mathcal{O}_Y(f^{-1}(U)) = \operatorname{colim}_{\mathfrak{p} \in D(g)} \mathcal{O}_Y(f^{-1}(D(g))) = (A \setminus \mathfrak{p})^{-1}B,$$
where $(A\setminus \mathfrak{p})$ is viewed as a multiplicative set in $B$ via $\varphi$. To clarify this computation:
- The first equality follows from definition.
- The second equality follows from the fact that distinguished open sets form a basis of Zariski topology.
- The last one is a consequence of the fact that $f^{-1}(D(g))= D(\varphi(g))$ (can you prove this?)
By an abuse of notation, we can assume that $A \subset B$ since $\varphi$ is injective. So we have reduced the question to proving the canonical morphism
$$A_{\mathfrak{p}} \longrightarrow (A\setminus \mathfrak{p})^{-1}B \ \ \ \ \frac{a}{s} \longmapsto \frac{a}{s}$$
is injective. This should be obvious.
Since you seem to be confused about stalks. I would say that the stalks we are taking, i.e.
$$\mathcal{O}_{X,\mathfrak{p}} \longrightarrow (f_*\mathcal{O}_Y)_{\mathfrak{p}}$$
is completely different from the ones
$$\mathcal{O}_{X,f(\mathfrak{q})} \longrightarrow \mathcal{O}_{Y,\mathfrak{q}}$$
coming from the definition of a morphism of locally ringed spaces (for which we require them to be local maps). The first one is obtained by taking stalks of two sheaves $\mathcal{O}_X$ and $f_*\mathcal{O}_Y$ which are both sheaves on $X$ so you can only speak about stalks of points of $X$. Another point is that the morphisms $\mathcal{O}_{X,\mathfrak{p}} \longrightarrow (f_*\mathcal{O}_Y)_{\mathfrak{p}}$ exist beforehand at the level of sheaves while $\mathcal{O}_{X,f(\mathfrak{q})} \longrightarrow \mathcal{O}_{Y,\mathfrak{q}}$ do not come from a morphism of sheaves.
In fact, the second one is obtained from the first one by
\begin{equation}
\begin{split}\mathcal{O}_{X,f(\mathfrak{q})} = \operatorname{colim}_{f(\mathfrak{q}) \in U} \mathcal{O}_X(U) = & \longrightarrow \operatorname{colim}_{\mathfrak{q} \in f^{-1}(U)} \mathcal{O}_Y(f^{-1}(U)) = (f_*\mathcal{O}_Y)_{f(\mathfrak{q})} \\ & \longrightarrow \operatorname{colim}_{\mathfrak{q} \in V}\mathcal{O}_Y(V) = \mathcal{O}_{Y,\mathfrak{q}}.\end{split} \end{equation}
You can see that the second morphism is obtained by the universal property of colimits, or I can say that the indexing sets are different, one varies over open subsets of form $f^{-1}(U)$ and one varies over all open subsets.