Let $L/K$ be the splitting field of $f$. Let $\alpha_1$ be a root of $g_1$ and $\alpha_2$ be a root of $g_2$. From field theory, since $\alpha_1$ and $\alpha_2$ have the same minimal polynomial over $F$ and $L/F$ is normal, we get $\sigma \in \operatorname{Aut}(L/F)$ such that $\sigma(\alpha_1) = \alpha_2$. Since $K/F$ is normal, $\sigma|_K \in \operatorname{Aut}(K/F)$, still with $\sigma|_K(\alpha_1) = \alpha_2$.
Now $g_2$ is irreducible in $K$ and $g_2(\alpha_2) = 0 \in L$, so $g_2$ is the minimal poolynomial of $\alpha_2$ over $K$. However, $\sigma|_K(g_1)$ is also irreducible in $K$, and $(\sigma|_K(g_1))(\alpha_2) = (\sigma|_K(g_1))(\sigma(\alpha_1)) = \sigma|_K(g_1(\alpha_1)) = 0$, so $\sigma|_K(g_1)$ is also the minimal polynomial of $\alpha_2$ over $K$.
Since minimal polynomial is unique, we conclude $\sigma|_K(g_1) = g_2$.
A counter-example when $K/F$ is not normal is $F=\Bbb Q$ and $K=\Bbb Q(\sqrt[3]2)$ and $f = X^3-2 \in F[X]$, with $f = (X-\sqrt[3]2)(X^2+\sqrt[3]2X+\sqrt[3]4) \in K[X]$.