For a finite number of factors, the direct sum and direct product of abelian groups (and more generally, of $R$-modules) are equal.
However, when you have an infinite number of summands/factors, the two constructions are different. Explicitly, the direct product
$$\prod_{i\in I} A_i$$
is the collection of all functions $f\colon I\to \cup A_i$ with $f(i)\in A_i$ for each $i$ (you can think of them as the "tuples" indexed by $i$, with the $i$th coordinate being the value $f(i)$).
But the direct sum
$$\bigoplus_{i\in I} A_i$$
is the collection of all functions $f\colon I\to \cup A_i$ with:
- $f(i)\in A_i$ for each $i$; and
- $f(i) = 0$ for all except perhaps a finite number of $i$.
That is, the direct sum is the subgroup/submodule of the direct product that consists of the almost-null elements. When there are only finitely many coordinates, saying "all are zero except perhaps for a finite number of coordinates" is the same as saying nothing.
For categories where the coproduct is not the direct sum (for example, when dealing with not-necessarily-abelian groups), it used to be common to refer to the direct product as the "cartesian product", the "unrestricted direct product", or even the "complete direct product" or "complete direct sum" (e.g., Hungerford offers the latter as a parenthetical alternative in page 59); and to refer to the subgroup of almost-null elements as the "restricted direct product" or "weak direct product" (again, the latter is used in Hungerford).
In the category of abelian groups, the direct (cartesian) product is a product, in the categorical sense: $P=\prod\limits_{i\in I}A_i$ is a group, equipped with homomorphism $\pi_i\colon P\to A_i$ for each $i$ (the projections), with the universal property that for every abelian group $B$ with homomorphism $f_i\colon B\to A_i$ for each $i\in I$, there exists a unique $f\colon B\to P$ such that $f_i =\pi_i\circ f$ for each $i\in I$; the map $f$ is defined by letting $f(b)(i) = f_i(b)$ (remember that the elements of $P$ are maps $g\colon I\to\cup A_i$ with $g(i)\in A_i$ for each $i$; that's why we have $f(b)(i)$: $f(b)$ is a map from $I$ to $\cup A_i$, so $f(b)(i)$ is the map $f(b)$ evaluated at $i$).
The direct sum, on the other hand, is a coproduct in the categorical sense. $C=\oplus_{i\in I}A_i$ is a group, equipped with homomorphism $\iota_j\colon A_j\to C$ for each $j\in I$ (the map that sends $a\in A_j$ to the element that has $a$ in the $j$th coordinate and $0$s elsewhere), with the universal property that for every abelian group $B$ with homomorphism $g_i\colon A_i\to B$, there exists a unique homomorphism $g\colon C\to B$ such that $g_i = g\circ \iota_i$ for each $i$.
Because the set of homomorphisms from one abelian group to another form an abelian group (under pointwise addition) and composition is bilinear under this addition, then one can prove that any object which is a product for $A$ and $B$ is also a coproduct for $A$ and $B$ and conversely, any object which is a coproduct is also a product (Theorem 2 in Section VIII.2 of Categories for the Working Mathematician, by Saunders Mac Lane); in particular, finite products coincide with finite coproducts in the category of all abelian groups, which is why the direct product and direct sum agree when there are only finite many factors/summands.