$\DeclareMathOperator{\Spec}{Spec}$Let's go through this carefully. We have $X = \Spec R$, an open subset $U \subset X$, and a morphism of schemes $g\colon \Spec A_j \to X$ which induces an isomorphism $(\Spec A_j, \mathscr{O}_{\Spec A_j}) \to (U, \mathscr{O}_X|_U)$. We find an element $f \in R$ such that $D(f) \subset U$. Now, Hartshorne proves earlier that $g$ corresponds to a homomorphism $\varphi\colon R \to A_j$, so that $g(\mathfrak{p}) = \varphi^{-1}(\mathfrak{p})$. And you can check that $g^{-1}(D(f)) = D(\varphi(f)) = D(f_j)$. (This is one way of proving that $g$ so induced are continuous.)
So the isomorphism will restrict to an isomorphism $(D(f_j), \mathscr{O}_{\Spec A_j}|_{D(f_j)}) \to (D(f), \mathscr{O}_X|_{D(f)})$. Replacing the source and target of this by isomorphic schemes, we get an isomorphism $\Spec (A_j)_{f_j} \to \Spec R_f$. Perhaps using an equals sign is a bit cavalier, but you'll have to get used to it.