We start with a bijective mapping
$\tag 1 f: \Bbb N \cong B$
Using $f$ we define another function
$\tag 2 \Phi: \mathcal P(B) \setminus \emptyset \to B$
$\quad \quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad X \mapsto f\bigr(\,\text{min}(f^{-1}(X))\,\bigr)$
If $A \subset B$ and $A$ is not finite, we can recursively build another function $g: \Bbb N \to A$ by setting
$\quad g(1) = \Phi(A)$
and with $g(1), g(2), \dots, g(n)$ set, defining
$\quad g(n+1) = \Phi\bigr(A \setminus \{g(1), g(2), \dots, g(n)\}\bigr)$
Exercise 1: Show that $g$ is a well-defined (recursive) function.
Exercise 2: Show that $g$ is a bijective correspondence,
$\tag 3 g: \Bbb N \cong A$
Here is another proof.
A set $C$ is countable if there exist a surjection $h: \Bbb N \to C$. In fact, an explicit bijection $\Bbb N \cong C$ can be constructed using $h$ (see, for example, this).
Addressing the interesting situation, let $B$ be an infinite set contained in a countable set $A$. Let $f: \Bbb N \cong A$ exhibit the $\text{1:1}$ correspondence. Choose any element $b_0 \in B$ and define
$$
F(m) = \left\{\begin{array}{lr}
f(m), & \text{for } m \in f^{-1}(B) \\
b_0 , & \text{for } m \in \mathbb N \setminus f^{-1}(B)
\end{array}\right\}
$$
The mapping $F: \Bbb N \to B$ is a surjection.