What follows is a common way to introduce the cup product.
"We can't define a worthy product in homology. That is true because we would need to make a sequence that goes like
$$ H_p(X) \otimes H_q(X) \stackrel{\times}{\to} H_n(X \times X) \to H_n(X),$$
and to fill the right arrow the only reasonable options would be projections, which would kill any information we could have gathered by taking the product.
However, in cohomology, we can do the following:
$$ H^p(X; \Lambda) \otimes H^q(X;\Lambda) \stackrel{\times}{\to} H^{p+q}(X\times X;\Lambda) \to H^{p+q}(X;\Lambda),$$
where now the last map is $d^*$, the adjoint of the (induced chain map of the) diagonal map, and this does not ignore information as would our previous suggestion."
I feel a bit cheated by the above introductory discussion. I accept that the projections would be "loss of information", but what, really, makes the diagonal map contain relevant information? I can see why it is a reasonable idea to consider it (just formally speaking, in the sense that the diagonal goes to a product and is a "natural" map to consider in this context by lack of anything else), but I don't understand why one should expect it to be a good idea beforehand. My question then bogs down to:
Why should one expect to have a relevant operation coming from the definition of the cup product (more specifically, by considering the adjoint map of the diagonal)? Is there some intuition behind it?
For good spaces $X$, we can describe $H^0(X, \mathbb{R})$ as the vector space of locally constant functions from $X$ to $\mathbb{R}.$
So suppose you wanted to redefine the multiplication of functions: $f\cdot g(z) := f(z) g(z)$ using diagrams. Well, there is a map $$Fun(X, \mathbb{R}) \otimes Fun(X, \mathbb{R}) \to Fun(X \times X, \mathbb{R})$$ given by $f \otimes g \mapsto f(x)g(y)$. This map is like the Kunneth isomorphism. And to get multiplication of functions from this we pullback along the diagonal: $\Delta^*(h(x,y))(z)= h(z,z)$, to get $f(z) g(z)$
$$Fun(X, \mathbb{R}) \otimes Fun(X, \mathbb{R}) \to Fun(X \times X, \mathbb{R}) \to Fun(X, \mathbb R)$$
by $f \otimes g \mapsto f(z) g(z)$.
So really, if you think of cohomology as an "enhancement" of locally constant functions, then this definition of the cup product makes a lot of sense to try.