I am aware this question has already been answered e.g. here and here, but in our lecture script we have a proof via contradiction (as the second answer also suggests), and there is one step that is unclear to me.
So, let $(U, d)$ be a metric space, and let $U$ be totally bounded and complete, then we want to show it is compact. Here the proof:
Let $\{V_j\}_{j\in J}$ be an open cover of $U$, s.t. $$U \subset \bigcup_{j\in J}V_j.$$ We now define $$\mathcal B := \left\{B \subset U \bigm| B\subset \bigcup_{i\in I}V_i \Rightarrow I \ \text{infinite, where}\ I\subset J\right\}$$ and show that $U\notin\mathcal B$.
Since $U$ is totally bounded, for every $\epsilon > 0$ there is an open cover $$U\subset \bigcup_{i=1}^{n_{\epsilon}}B_{\epsilon}(\varphi_i)$$ with elements $\varphi_1, \dots, \varphi_{n_\epsilon}\in U$. Further, to each $B\in\mathcal B$ there is an $i \equiv i(\epsilon)$ with $B_{\epsilon}(\varphi_i)\cap B\in\mathcal B$. If $U\in\mathcal B$, then we will inductively (for $\epsilon_k = 1/k$) construct points $\varphi_k\in U$ and sets $$B_k = B_{\epsilon_k}(\varphi_k) \cap B_{k - 1} \in\mathcal B\quad\text{for}\ k\geq 2,$$ where $B_1 = U\in\mathcal B$, s.t. $B_k\subset B_{k-1}\subset\dots\subset B_2\subset B_1 = U$.
Choose $\psi_n\in B_n$, then $$d(\psi_k, \psi_l) \leq d(\psi_k, \varphi_k) + d(\varphi_k, \psi_l) \leq 2\epsilon_k \quad \text{for}\ k\leq l,$$ and hence $(\psi_n)_{n\in\mathbb N}$ is a Cauchy sequence in $U$. Since $U$ is complete, $(\psi_n)_{n\in\mathbb N}$ converges in $U$; denote the limit by $\psi\in U$. Since $\psi\in V_{j_0}$ for a $j_0\in J$, we have $$B_k \subset B_{\epsilon_k}(\varphi_k)\subset B_{2\epsilon_k}(\psi_k) \subset B_{2\epsilon_k + d(\psi_k, \psi)}(\psi)\subset V_{j_0}$$ for sufficiently large $k$, i.e. $B_k\notin \mathcal B$, which is a contradiction.
The point that is confusing me is why to every $B\in\mathcal B$ there's an $i\equiv i(\epsilon)$ s.t. $B(\varphi_i, \epsilon) \cap B\in\mathcal B$. We have that $B\cap B_{\epsilon} (\varphi_i) \subset B\in\mathcal B$, but how can we be sure that by intersecting $B$ with $B_{\epsilon}(\varphi_i)$, it cannot be covered by a finite collection of $\{V_i\}_{i\in I}$?