I think that the proof of this is actually not so hard, but it is rather long and fiddly. I also think that being able to reproduce this proof is actually a pretty good indicator for whether or not you really understand the general procedure of showing that some property of morphisms holds for some affine cover iff it holds for every affine cover, since they're all more or less the same apart from the interchanging of some algebraic results at the end. Anyway, here's the proof:
First recall the very important fact that given any two affine open subschemes $U$ and $V$ of a given scheme $X$, their intersection can be covered by open subchemes that are simultaneously distinguished open affine subschemes for $U$ and for $V$. This will be used multiple times in this proof, as well as many others.
Thus we may cover $V$ by open subschemes that are simultaneously distinguished affine open subschemes for $V$ and some $V_i$. Since the collection of all such subschemes cover $V$, the collection of all such pre-images will cover $f^{-1}(V)$. Let $V'$ be one such open subscheme, say $V' \cong D(g), D(g_i)$ where $g \in B$ and $g_i \in B_i$. We may further cover $f^{-1}(V')$ by open subschemes which are each distinguished open affine for some $U_{i,j}$. Let $U'$ be one such, say $U' \cong D(f_{i,j})$ for some $f_{i,j} \in A_{i,j}$.
Now, the restriction of $f:U_{i,j}\rightarrow V_i$ is induced by a ring map $\varphi_{i,j}:B_i\rightarrow A_{i,j}$ making $A_{i,j}$ a finitely generated $B_i-$algebra. Since $U' \subset f^{-1}(V\cap V_i)$, we know that $f:U'\rightarrow V_i$ is induced by the (localization of the) map $\varphi_{i,j}$, but also that it is induced by a map $\varphi:B\rightarrow (A_{i,j})_{f_{i,j}}$. We will show that this makes $A:=(A_{i,j})_{f_{i,j}}$ into a finitely generated $B$-algebra and we will be done.
We already used the fact that $U' \subset f^{-1}(V)$ and $U' \subset f^{-1}(V_i)$ to get the ring maps $\varphi$ and $\varphi_{i,j}$, but we also have that $U' \subset f^{-1}(V')$, which gives us two more ring maps induced by $f$, $\psi:B_g \rightarrow A$ and $\psi_{i,j}:(B_i)_{g_i} \rightarrow A$. By the construction of $V'$ and $U'$, it follows that $\psi$ is the localization of $\varphi$ and $\psi_{i,j}$ is the localization of $\varphi_{i,j}$ composed with the localization map $A_{i,j} \rightarrow A$. Moreover, these two maps commute with the isomorphism $B_g \cong (B_i)_{g_i}$.*
Now, the coup de grâce: by assumption $A_{i,j}$ was a finitely generated $B_i$-algebra and so $A=(A_{i,j})_{f_{i,j}}$ is a finitely generated $B_i$-algebra. But then it is a finitely generated $(B_i)_{g_i}$-algebra, which is equivalent to being a finitely generated $B_g$-algebra. Finally, being a finitely generated $B_g$-algebra implies that it is a finitely generated $B$-algebra, which is what we were looking for, so we win.
Remark: You can perhaps streamline the proof a little by taking $U' = U_{i,j} \cap f^{-1}(V')$ but I don't think this makes the proof any easier or quicker.
*This can be tricky to see, although it may also be completely obvious. Either way, I recommend drawing a picture of all of the open affine schemes involved, showing where each maps to under $f$ and which are contained in others. You can then draw the corresponding diagram of rings and maps between them to see why this is true. It is important to actually do this step, though it is often overlooked, since $A$ being a finitely generated $B$ algebra is a property dependent on the map from $B$ to $A$, so if we don't know what the ring maps are, then you can't possibly complete the proof.
I think that you’re mixing indices a bit, but the proof is correct. Let’s see if we can’t rephrase it a little bit to make it clearer.
I’m using “locally of finite type” as per your definition (I believe that there are other definitions that fortunately turn out to be equivalent), and “AF type” for the stronger property of a map $\operatorname{Spec}{B} \rightarrow \operatorname{Spec}{A}$ corresponding to a ring homomorphism $A \rightarrow B$ making $B$ a finitely-generated $A$-algebra.
Let’s first digress.
The definition of “locally of finite type” can thus be written as follows: let $f: X \rightarrow Y$ be a morphism of schemes. It is of finite type if there exists an affine open cover $Y=\bigcup_i{V_i}$ such that every $f^{-1}(V_i)$ has an affine open $f^{-1}(V_i)=\bigcup_j{U_{i,j}}$ such that every $f: U_{i,j} \rightarrow V_i$ is AF type.
Also consider the following statement: if $A$ is a $B$-algebra and $f_1,\ldots,f_r \in A$ are such that $(f_1,\ldots,f_r)=A$ and every $A_{f_i}$ is finitely generated over $B$, then $A$ is a finitely generated $B$-algebra. In the scheme-theoretic language above, this is equivalent to: a morphism of affine schemes $X \rightarrow Y$ which is locally of finite type for the open cover $Y$ [“locally of finite type” is enough, given your proof] is AF type. So it’s not the same thing (and it’s an important fact as well)!
Anyway, now for the proof. Your argument can be rephrased as follows:
Fix affine open covers $Y=\bigcup_i{V_i}$ and $f^{-1}(V_i)=\bigcup_j{U_{i,j}}$. We can also find affine open covers $V_i \cap V=\bigcup_k{W_{i,k}}$ where the $W_{i,k}$ that are principal in $V_i$ and in $V$ (this deserves elaboration if you haven’t done it yourself, in my opinion).
In particular, it is formal that the $f: U_{i,j} \cap f^{-1}(W_{i,k}) \rightarrow W_{i,k}$ are AF type (as “principal base change” of $f: U_{i,j} \rightarrow V_i$). But $W_{i,k} \subset V$ is AF type (as $W_{i,k}$ is principal in $V$), so $f: U_{i,j} \cap f^{-1}(W_{i,k}) \rightarrow V$ is AF type.
Now, every $U_{i,j}\cap f^{-1}(W_{i,k})$ is affine, and
$$\bigcup_{i,j,k}{U_{i,j}\cap f^{-1}(W_{i,k})} = \bigcup_{i,k}{f^{-1}(V_i) \cap f^{-1}(W_{i,k})}= f^{-1}\left(\bigcup_{i,k}{V_i \cap W_{i,k}}\right)=f^{-1}\left(\bigcup_i{V\cap V_i}\right)=f^{-1}(V). $$
Best Answer
From the comments: the $B_i$-algebra structure on $A_{ij}$ is induced via the map $f|_{\operatorname{Spec} A_{ij}} \operatorname{Spec} A_{ij} \to \operatorname{Spec} B_{i}$. This is the algebra structure Hartshorne refers to when he says that $A_{ij}$ is a finitely-generated $B_i$-algebra. (Compare to Stack's definition, where the connection between the map $f$ and the algebra structure is slightly more explicit.)