Suppose $A \hookrightarrow B$ is a finite injective Ringhomomorphism, where $A$ is a UFD and $B$ is an integral domain. Let $f \in B$ and $P=T^n + a_{n-1} T^{n-1} + \cdots + a_0 \in A[T]$ be irreducible with $P(f)=0$. Given $y$ a maximal ideal in $A$ and $\alpha$ a root of $\tilde{P}=T^n + [a_{n-1}] T^{n-1} + \cdots + [a_0] \in (A/y)[T]$ the proof I'm reading states the existence of a maximal ideal $x$ in $B$ with $y = A \cap x$ (this part is just Lying over?) and $\alpha = [f] \in B/x$.
I would be thankful if anyone explained to me why this is the case.
Let $g\in (A/y)[T]$ be a minimal polynomial of $\alpha$, then $\tilde{P}\in (g)$ and $(g)$ is a maximal ideal of $(A/y)[T]$. Consider the quotient map $\pi: A[T]\to (A/y)[T]$, the preimage of $(g)$ in $A[T]$ is a maximal ideal $I$. This ideal maps onto a maximal ideal of the subring $A[f]$ of $B$ through the map $$\begin{aligned} \varphi:A[T] &\to B\\ T &\mapsto f \end{aligned}$$ Indeed, note that $P$ is irreducible so $\text{ker }\varphi=(P)$. Since $P\in I$ we have $(P)\subset I$, which implies that $I$ maps onto a maximal ideal of the quotient ring $A[f]\cong A[T]/(P)$.
It is clear that $B$ is an integral extension of $A[f]$, so there exists a maximal ideal $x$ of $B$ such that $x\cap A[f]=\varphi(I)$ (this is where you apply Lying over). Now $\varphi^{-1}(x)=I$, hence $\varphi$ induces an inclusion of fields $\bar{\varphi}:A[T]/I\to B/x$. By the definition of $I$, $A[T]/I\cong (A/y)[T]/(g)\cong (A/y)(\alpha)$, and $T$ corresponds to $\alpha$ under this isomorphism. It follows that $\alpha$ corresponds to $\bar{\varphi}(T)=[f]\in B/x$.