Why the ideal defining a closed subscheme is unique? Let $X$ be a scheme.
We defined a closed subscheme of $X$ to be a scheme $(Z, \mathcal{O}_Z)$ such that $Z$ is a closed subset of $X$
and $i_*\mathcal{O}_Z \simeq \mathcal{O}_X/\mathcal{J}$, where $\mathcal{J}$ is an ideal of $\mathcal{O}_X$ and $i : Z \hookrightarrow X$ the inclusion map.
Why the ideal $\mathcal{J}$ is unique ?
 A: A closed subscheme of a scheme $X$ is a closed immersion $j:Z\hookrightarrow X$ such that $Z$ is a closed subset of $X$, $j$ is the inclusion of this closed subset into $X$ (on the level of topological spaces), and $j^\sharp:\mathscr{O}_X\to j_*\mathscr{O}_Z$ is surjective (as a map of sheaves). This means that if $\mathscr{J}=\ker(j^\sharp)$, we get an induced isomorphism $\bar{j}^\sharp:\mathscr{O}_X/\mathscr{J}\simeq j_*\mathscr{O}_Z$. 
Now, what is the precise meaning of your question? Given closed subschemes $Z_1,Z_2\hookrightarrow X$ (as defined above), if $Z_1\simeq Z_2$ as $X$-schemes, meaning the isomorphism $g$ is compatible with the closed immersions $j_1,j_2$ to $X$, then is it true that $\mathscr{J}_1=\mathscr{J}_2$ (these are the kernels of the respective comorphisms $j_1^\sharp,j_2^\sharp$)? Yes. This is because we have, by assumption $j_2\circ g=j_1$. This gives a corresponding relation on the level of maps of sheaves: $(j_2\circ g)^\sharp=j_1^\sharp$. By definition $(j_2\circ g)^\sharp$ is $j_{2,*}(g^\sharp)\circ j_2^\sharp$. So $j_{2,*}(g^\sharp)\circ j_2^\sharp=j_1^\sharp$ as morphisms $\mathscr{O}_X\to j_{1,*}\mathscr{O}_{Z_1}$. Since $g^\sharp$ is an isomorphism, $j_{2,*}(g^\sharp)$ is an isomorphism, and it follows that $\mathscr{J}_1=\ker(j_1^\sharp)=\ker(j_2^\sharp)=\mathscr{J}_2$.
The general statement (having nothing to do with schemes, and only locally ringed spaces) is that there is a canonical bijection between $X$-isomorphism classes of closed immersions with target $X$ and ideal sheaves, where the ideal sheaf corresponding to a closed immersion is the kernel of the comorphism as above. The other direction of the bijection sends an ideal sheaf $\mathscr{J}$ to the $X$-isomorphism class of the locally ringed space $(V(\mathscr{I}),j^{-1}(\mathscr{O}_X/\mathscr{J}))$ where $V(\mathscr{I})=\mathrm{supp}(\mathscr{O}_X/\mathscr{J})$, $j:V(\mathscr{J})\hookrightarrow X$ is the inclusion, and the morphism $j^\sharp:\mathscr{O}_X\to j_*j^{-1}(\mathscr{O}_X/\mathscr{J})$ is the composite of $\mathscr{O}_X\to\mathscr{O}_X/\mathscr{J}$ with the map $\mathscr{O}_X/\mathscr{J}\to j_*j^{-1}(\mathscr{O}_X/\mathscr{J})$ coming from the adjunction between $j^{-1}$ and $j_*$ (which is an isomorphism in this case because $j$ is a closed topological embedding and $\mathscr{O}_X/\mathscr{J}$ is supported in $V(\mathscr{J})$).
The ring version of this is as follows: if $I$ and $J$ are ideals of a ring $R$ and there is an $R$-algebra isomorphism $R/I\simeq R/J$, then $I=J$. 
