A locally ringed space is a pair $(X,\mathcal{O}_X)$ of a topological space $X$ and a sheaf of rings $\mathcal{O}_X$. Then we say that $(f,f^b):(X,\mathcal{O}_X)\rightarrow (Y,\mathcal{O}_Y)$ is a morphism of locally ringed spaces if $f:X\rightarrow Y$ is a continuous map and $f^b:\mathcal{O}_Y\rightarrow f_*\mathcal{O}_X$ is a morphism of sheafs on $Y$ s.t. the induced map for $x\in X$ $$f^b_x:\mathcal{O}_{Y, f(x)}\rightarrow \left(f_*\mathcal{O}_X\right)_{f(x)}\rightarrow O_{X,x}$$ satisfies $$f(\mathfrak{m}_{f(x)})\subseteq \mathfrak{m}_x$$where $\mathfrak{m}_{f(x)}$ is the maximal ideal of $\mathcal{O}_{Y, f(x)}$
I somehow understand this definition up to the point where we start speaking about this induced map. I don't see what the mean by $\mathcal{O}_{Y,f(x)}$ or all the other double indices there and I also don't see why we have this extra condition or more precisely how this extra condition works. Do we really need this condition for the definition of a morphism of locally ringed spaces?
Can someone explain this to me?
One reason for us to work with locally ringed spaces is that a scheme is a locally ringed space.
The condition that $f_x^b$ is a local ring morphism implies that when $X$ and $Y$ are two schemes, whenever you have two open affine subschemes $SpecA \subset X$ and $SpecB \subset Y$ such that $f$ maps $SpecA$ into $SpecB$, $f: SpecA \to Spec B$ is induced by some ring morphism $\phi: B \to A$.
For your question on stalks, you can unpack the definition of colimit and see that since we are working with sheaves of rings, elements of a stalk $\mathcal{O}_{X,x}$ are "germs", i.e. equivalence classes $[f,U]$ where $f \in \mathcal{O}_X(U)$ and U is open and contains x. [f,U]=[g,V] whenever f and g, when restricted to $U\cap V$, are the same.