Why does a union have to be disjoint to constitute a coproduct?

Matt Samuel has given you why specifically the union fails. Here is why the disjoint union has to be the correct notion of "union".

In category theory, when talking about sets, we don't care what elements lie in the set. That's because category theory only talks about objects up to isomorphism. So if we took $A$ and $B$ of the same size, the coproduct has to be phrased in a way that doesn't care whether or not $B = A$.


Try taking the coproduct of a set with one element with itself and use ordinary union. Pick two different maps into another set. Do they factor through one map from this potential coproduct, which has one element?


Let us work with just two sets, $X_1$ and $X_2$. Let $X_1 \sqcup X_2 = (X_1 \times \{1\}) \cup (X_2 \times \{2\})$ be their disjoint union, and consider the morphisms $i_j : X_j \to X_1 \sqcup X_2$ given by $i_j (x) = (x,j)$.

Assume the coproduct to be the non-disjoint union, with the morphisms $f_j : X_j \to X_1 \cup X_2$, $f_j(x) = x$.

You know that there exist a unique morphism $f : X_1 \cup X_2 \to X_1 \sqcup X_2$ such that $f \circ f_j = i_j$.

Now, the core of the issue: assume that there exist $x \in X_1 \cap X_2$. Then

$$(x,1) = i_1 (x) = (f \circ f_1) (x) = f (x)$$

and similarly $(x,2) = f(x)$, which shows that $f$ is not well defined.