Using the regularity of $\kappa$ and the fact that the infinite cardinal $\lambda$ is less than $\kappa$, Jech notes that
$$ \kappa^\lambda=\bigcup_{\alpha<\kappa}\alpha^\lambda, $$
where both sides are understood as sets of functions. From this, he claims that, as cardinals,
$$ \kappa^\lambda=\sum_{\alpha<\kappa}|\alpha|^\lambda. $$
This would be obvious if the sets $\alpha^\lambda$ were disjoint as $\alpha$ varies but, as you point out, this is clearly not the case.
You suggest instead to replace these sets by disjoint copies, say replacing $\alpha$ by $\hat\alpha=\{\alpha\}\times\alpha$ for each $\alpha<\kappa$. This changes the union $\bigcup_\alpha\alpha^\lambda$ into the disjoint union $\bigcup_\alpha\hat\alpha^\lambda$. Note that there is an obvious injection from the former into the latter: Given any function $f\in\bigcup_\alpha\alpha^\lambda$, find the least $\alpha$ such that $f\!:\lambda\to\alpha$, and map $f$ to its copy in $\hat\alpha^\lambda$.
This means that
$$ \kappa^\lambda\le\sum_{\alpha<\kappa}|\alpha|^\lambda. $$
However, Jech is claiming more, namely, equality rather than the inequality we just showed.
Luckily for us, the inequality
$$ \sum_{\alpha<\kappa}|\alpha|^\lambda\le\kappa^\lambda $$
is quite easy to establish: First, for each $\alpha<\kappa$, $|\alpha|^\lambda\le\kappa^\lambda$, so $\sum_{\alpha<\kappa}|\alpha|^\lambda \le \sum_{\alpha<\kappa}\kappa^\lambda=\kappa\cdot\kappa^\lambda=\kappa^\lambda$. Note that this is the only place where we used that $\lambda$ is infinite (in fact, it suffices that $\lambda>0$).
From the two inequalities, the claimed equality now follows. Let me close by pointing out that this is a really useful heuristic: just as equality of sets is two containments, many equalities in cardinal arithmetic are really two inequalities.
In the case at hand, one of the inequalities turned out to be obvious upon inspection. This is actually not so uncommon. The strategy you suggested, of replacing a union by a disjoint union so that its cardinality can be estimated via Jech's definition of infinite sums of cardinals, turns out to be very useful in practice.
At the top of p. 158 of your book, the authors write the following:
Infinite products are more difficult to evaluate than infinite sums. In some special cases ... some simple rules can be proved.
What they're telling you is that you shouldn't expect a simple formula that applies to all infinite products like the one they give for infinite sums. And this is not so surprising: repeated cardinal addition is related to cardinal multiplication, which is a very simple operation. But repeated cardinal multiplication is related to cardinal exponentiation, which is extremely complicated.
In the comments, you made the reasonable guess that $$\prod_{\alpha<\lambda} \kappa_\alpha = (\sup\{\kappa_\alpha\mid \alpha<\lambda\})^\lambda.$$
The formula for infinite sums assumes that all of the $\kappa_\alpha$ are non-zero. To have a hope of the above formula holding, we should assume that all of the $\kappa_\alpha$ are not equal to $0$ or $1$. This handles silly counterexamples like the one in Max's comment. And it's not so bad, because we can remove all $1$ terms from the product without changing its value, while if a single $0$ term appears, the whole product is $0$.
Ok, your guess is reasonable because we have an obvious upper bound: $$\prod_{\alpha<\lambda} \kappa_\alpha \leq (\sup\{\kappa_\alpha\mid \alpha<\lambda\})^\lambda.$$ And equality is achieved sometimes, e.g. as computed on the same page of your book: $$\prod_{n<\aleph_0} n = 2^{\aleph_0} = \aleph_0^{\aleph_0} = (\sup\{n\mid n<\aleph_0\})^{\aleph_0}.$$
On the other hand, it can fail, e.g. assume the continuum hypothesis (we actually only need $2^{\aleph_0} < \aleph_\omega$), let $\kappa_0 = \aleph_\omega$, and let $\kappa_n = 2$ for all $1\leq n<\aleph_0$:
$$\prod_{n<\aleph_0} \kappa_n = \aleph_\omega \cdot \prod_{1\leq n<\aleph_0} 2 = \aleph_\omega \cdot 2^{\aleph_0} = \aleph_\omega < (\aleph_\omega)^{\aleph_0} = (\sup\{\kappa_n\mid n<\aleph_0\})^{\aleph_0}.$$
The fact that $\aleph_\omega < (\aleph_\omega)^{\aleph_0}$ follows from König's Theorem: $$\aleph_\omega = \sum_{n< \aleph_0} \aleph_n < \prod_{n<\aleph_0} \aleph_\omega = (\aleph_\omega)^{\aleph_0}.$$
If you don't want to assume the continuum hypothesis, you can replace $\aleph_\omega$ with any cardinal $\kappa>2^{\aleph_0}$ such that $\text{cf}(\kappa) = \aleph_0$ (if $2^{\aleph_0} = \aleph_\alpha$, then $\kappa = \aleph_{\alpha+\omega}$ works), and the same argument goes through.
Best Answer
The point here is what does cardinal mean.
In many contexts, and perhaps naively, one might consider cardinals to mean initial ordinals, so that a set which cannot be well-ordered does not have a cardinal. In this context it is not hard to prove that $\kappa+\kappa=\kappa$ for any infinite cardinal, simply because this easily holds for well-ordered cardinals.
In many contexts, which are different, and also perhaps naively, one considers a cardinal to be something representing cardinality of sets. This can be done in multiple ways, and it doesn't really matter, since cardinal arithmetic is really just the "quotient" of considering sets and injections, along with unions and products. In this case, you will need the axiom of choice. Suppose, for example, that $A$ is a set such that if $B\subseteq A$ then $B$ is finite or $A\setminus B$ is finite. These sort of sets are called amorphous and their existence is consistent with $\sf ZF$.
But now consider $|A|+|A|$, it's the cardinal of $A\times\{0,1\}$, which certainly can be split into two infinite subsets, $A\times\{0\}$ and $A\times\{1\}$. So, $|A|\neq|A|+|A|$ in that case. There are other examples that are consistent.
Sageev proved that if $\kappa+\kappa=\kappa$ for any infinite cardinal, in the latter sense, then we can deduce that every infinite set has a countably infinite subset (which, for example, prevents the existence of amorphous sets). But at the same time, we cannot even prove that every countable family of non-empty sets admits a choice function. So while the axiom of choice is needed, its "absolute necessity" here is very mild and hard to notice.
Finally, if we do assume the axiom of choice, then every set can be well-ordered, so the two contexts merge into one, and then we can prove the equality in a straightforward manner by replacing a set with whatever ordinal is in bijection with it.