I am intending that this will be the first of a three-part question. I'm a beginner to algebraic geometry so I just wanted to clear up a few simple things before I got to my main question.
Suppose I have a finite-type morphism $f: X \longrightarrow Y$ of schemes. Let $\text{Spec } B$ be affine in $Y$. Then we have that
$$ f^{-1}(\text{Spec }B) = \bigcup_{i = 1}^{N} \text{Spec }A_{i} $$
where each $\text{Spec }A_{i}$ is a finitely generated $B$-algebra via some morphisms
$$
\phi_{i}: B \longrightarrow A_{i}
$$
What I want to know is whether I can always find an open set $U \subseteq Y$ such that the induced morphism
$$
f^{-1}(U) \longrightarrow U
$$
is affine?
As far as I can see, this should be possible. Indeed, choose any particular $\text{Spec }A_{i}$ and drop the index for brevity so that we just have $\text{Spec }A$ and a morphism $\phi: B \longrightarrow A$. Then choose some $h \in B$. The preimage of $D(h)$ by $f$ will be $$ f^{-1}(D(h)) = D(\phi(h)), $$ and so the induced morphism will be $$ D(\phi(h)) \longrightarrow D(h). $$ Is this correct? In fact, this should work only requiring that $f$ be $\textit{locally}$ of finite-type, right?
$\newcommand{Spec}{\operatorname{Spec}}$You are mistaken that $f^{-1}(D(h))=D(\phi(h))$. Rather, what is true is that if we write $f|_{\Spec A}:\Spec A\to\Spec B$ for the restriction of $f$ to $\Spec A$, then we have $f|_{\Spec A}^{-1}(D(h))=D(\phi(h))$, which is really just saying that $f^{-1}(D(h))\cap\Spec A=D(\phi(h))$.
Another way to see that your assumption is incorrect is to just take $h=1$. Then $D(h)=\Spec B$ so $f^{-1}(D(h))=f^{-1}(\Spec B)$ which, as we know, is not necessarily equal to $\Spec A=D(\phi(h))$.