For an infinite disjoint union $X = \bigsqcup_\alpha X_\alpha$, it is at least intuitively clear why the homology of $X$ decomposes into a direct sum
$$H_n(X) \cong \bigoplus_\alpha H_n(X_\alpha),$$
since the singular chain groups $C_n(X)$ by definition contain only finite sums of singular simplices $\sigma: \Delta^n \to X_\alpha$, which corresponds to the finite sums of cycles on the right hand side.
However, Hatcher switches to using infinite products when he introduces Cohomology (for example, Example 3.14, and the section on axioms for Cohomology), and we instead have the relation
$$H^n(X) \cong \prod_\alpha H^n(X_\alpha). $$
Can someone provide an example where this isomorphism of Cohomology with the infinite product holds, but the infinite direct sum does not? I would prefer a non-category theory explanation if possible. Thanks!