Surprisingly, I can't find this exact question asked at MSE before. So, well-prepared to delete in case this is a duplicate after all, here goes:
This is a beautiful argument! Rather than work on $\mathbb{R}$, it will be convenient instead to work on the set of infinite binary sequences, which (to avoid confusion) I'll call "$\mathscr{B}$" here.
The key fact about $\mathscr{B}$ is that we can "code" a sequence of infinitely many binary sequences as a single binary sequence: given a sequence $\beta=(b_i)_{i\in\mathbb{N}}$ of elements of $\mathscr{B}$ (so $\beta$ is an infinite sequence of infinite binary sequences), let $[\beta]$ be the infinite binary sequence whose $\langle x,y\rangle$th term is $b_x(y)$. Here "$\langle \cdot,\cdot\rangle$" is the Cantor pairing function - or any other pairing function you like (just some bijection $\mathbb{N}^2\rightarrow\mathbb{N}$).
We can also go the other direction: given a binary sequence $b\in\mathscr{B}$ and a natural number $j$, let $b_{[j]}$ be the binary sequence whose $i$th term is $b(\langle i, j\rangle)$.
What this lets you do is "perform infinitely many diagonal arguments simultaneously." Specifically, suppose $A_i$ is a sub-continuum-sized subset of $\mathscr{B}$ for each $i\in\mathbb{N}$. For each $i$ we can find a $b_i$ such that no $a\in A_i$ has $a_{[i]}=b_i$. Now let $\beta(i)=b_i$, and consider $[\beta]$. Assuming I haven't botched my indexing (exercise: fix my almost-certain mistake!), we get that $[\beta]\not\in \bigcup_{i\in\mathbb{N}}A_i$.
Amazingly, this is essentially all we can prove about the size of the continuum in $\mathsf{ZFC}$. For example, each of the following is consistent with $\mathsf{ZFC}$ (assuming the latter is consistent itself in the first place, of course):
$2^{\aleph_0}=\aleph_1$. (This is the continuum hypothesis, CH.)
$2^{\aleph_0}=2^{\aleph_1}=2^{\aleph_2}=\aleph_{17}$. (So the continuum function doesn't need to be injective!)
$2^{\aleph_0}=\aleph_{\omega+1}$. (So we can "hop over" the forbidden value $\aleph_\omega$ - which is forbidden, by the above argument, since $\aleph_\omega=\sum_{i\in\omega}\aleph_i$.)
$2^{\aleph_0}=\aleph_{\omega_1}$. (This case is especially interesting, since it means that $\mathbb{R}$ is a union of fewer-than-continuum smaller-than-continuum sets.)
We just can't have $2^{\aleph_0}=\aleph_\omega$, or $\aleph_{\omega^2+\omega\cdot 42}$, or $\aleph_\alpha$ for any $\alpha$ with countable cofinality. And this is all thoroughly generalized by Konig's theorem.