There are multiple ways of attacking this:
Method 1:
Show that if $V\subseteq U$ is another affine containing $x$, then the maps $\text{Spec}(\mathcal{O}_{X,x})\to V$ and $\text{Spec}(\mathcal{O}_{X,x})\to U$ are the same (this isn't that hard) (EDIT: As Asal Beag Dubh points out below, this means that $\text{Spec}(\mathcal{O}_{X,x})\to U$ factors as $\text{Spec}(\mathcal{O}_{X,x})\to V\to U$). Then, for any two affines $W,U$ pass to some affine open $V\subseteq W\cap U$.
Method 2:
Let $Z\subseteq X$ be the subset of $X$ consisting of points which generalize $x$. Consider the topological map $i:Z\hookrightarrow X$. Define $\mathcal{O}_Z:=i^{-1}\mathcal{O}_X$. Shown then that $(Z,\mathcal{O}_Z)$ is a scheme, and that for any choice of affine $x\in U$ one has that $Z\to X$ is isomorphic to $\mathcal{O}_{X,x}$ (i.e. that $Z\cong \mathcal{O}_{X,x}$ in a way compatible with these mappings).
I want to respond to one particular statement you made, but first I'll make things a bit more precise.
We have the adjunction $$\newcommand\Hom{\operatorname{Hom}}\newcommand\Spec{\operatorname{Spec}}\newcommand\calO{\mathcal{O}}\Hom(X,\Spec A)\simeq \Hom(A,\Gamma(X,\calO_X)),$$ and in particular this tells us that
$$\Hom(X,\Spec \Gamma(X,\calO_X))\simeq \Hom(\Gamma(X,\calO_X),\Gamma(X,\calO_X)).
$$
The identity map $\Gamma(X,\calO_X)\to\Gamma(X,\calO_X)$ therefore gives us a map of schemes $X\to \Gamma(X,\calO_X)$ as you noticed, and this is indeed the canonical map. However, you seem to be under the impression that this map is therefore an isomorphism.
In general this cannot possibly be true, since if the map were an isomorphism, $X$ would necessarily have to be affine. However, if $X$ is affine, this map is indeed an isomorphism.
Let's be a little more clear how this map works then.
In fact let's be a little more clear how it works in general. Let $\phi : A\to \Gamma(X,\calO_X)$ be a ring morphism. Let's try to understand the induced map $f : X\to \Spec A$.
Let $U$ be an affine open in $X$. Then we have the maps
$$\newcommand\toby\xrightarrow A\toby{\phi}\calO_X(X)\toby{r_{XU}} \calO_X(U).$$
Taking $\Spec$ of this sequence gives
$$U\toby{\Spec r_{XU}} \Spec \calO_X(X) \toby{\Spec \phi} \Spec A.$$
Gluing these maps together gives the desired map from $X$ to $\Spec A$.
Observe then that if $\phi=\newcommand\id{\operatorname{id}}\id$, that the map $X\to \Spec \Gamma(X,\calO_X)$ is the result of gluing the maps obtained from applying the Spec functor to the restrictions $r_{XU}:\calO_X(X)\to \calO_X(U)$.
If $X$ is affine, then we can take $U=X$, and there's no need to glue, the map $X\to \Spec\Gamma(X,\calO_X)$ is $\Spec \id=\id$. On the other hand, if $X$ is not affine, for example, if $X$ is a projective $k$-scheme with $k$ algebraically closed, then $\Gamma(X,\calO_X)=k$, and $X\to \Spec\Gamma(X,\calO_X)$ is the $k$-scheme structure morphism $X\to \Spec k$, which in general is clearly not an isomorphism.
Best Answer
Let me add to Amitesh's absolutely correct answer a few words describing the image $I\stackrel {\text {def}}{=}Im(f)$ of the canonical morphism $f:\text{Spec} (\mathcal O_{X,x}) \to X$ .
a) The set $I$ is exactly the intersection of all neighbourhoodz of $x$ in $X$: it is a kind of microgerm of $X$ at $x$.
Beware that $I$ is not a subscheme of $X$ since it is not locally closed.
b) More geometrically (and thus more interestingly!) consider the irreducible subvariety $V=\overline {\lbrace x\rbrace}\subset X$ whose generic point is $x$.
Let $Y\subset X$ be a closed irreducible subscheme on which $V$ lies: $V\subset Y$ and let $\eta_Y$ be the generic point of $Y$.
Then our subset $I$ is exactly the set of all those generic points $\eta_Y$. We say that $I$ is the set of generizations of $x$.
c) Two examples:
1) If $X$ is an irreducible scheme with generic point $\eta$, then for $x=\eta$ we have $I={\lbrace \eta\rbrace}$.
2) If $X=\mathbb A^2_\mathbb C=\text {Spec}(\mathbb C[x,y])$ and $x=(a,b)$ (more accurately $x$ is the maximal ideal $\mathfrak m= (x-a,x-b)$) , then $I$ is the set consisting in $x$, the generic point of $\mathbb A^2_\mathbb C$ and the generic points of all irreducible curves going through $x$, like for example the curve $(y-b)^2-(x-a)^3=0$.