If $A_n$ is a countable set for each $n \in\mathbb N,$ then $$\bigcup_{n=1}^\infty A_n$$ is countable. How does arranging the natural numbers in a two-dimensional array allow one to show the statement given in the title?
Is it that, given any set $A_i$, being countably infinite, is in bijection with the $i$-th row of that two-dimensional array, itself being countably infinite, and therefore the collection of the sets $A_i$ is in the bijection with the set of rows in that two-dimensional array, which of course is in bijection with the natural numbers?
Since each $A_n$ is countable, there exists, for each $n$, a bijective function $f_n : \mathbb N \to A_n$.
Using these $f_n$'s, we can define a function $f : \mathbb N \times \mathbb N \to \cup_{n=1}^\infty A_n$, which sends each $(n, m) \in \mathbb Z \times \mathbb Z$ to the element $f_n(m) \subset A_n\subset \bigcup_{n = 1}^\infty A_n$. Clearly, this function $f$ is surjective.
So we have exhibited a surjective function $f$ from the countable set $\mathbb N \times \mathbb N$ onto the set $\bigcup_{n = 1}^\infty A_n$. Hence $\bigcup_{n=1}^\infty A_n$ is countable.
[The set $\mathbb N \times \mathbb N$ in this answer is the "two-dimensional array" referred to in your hint.]