This is the definition of direct product: let $\{X_i\}$, $i\in I$, be a family of objects in category $C$. A product $(X; p_i)$ is an object $X$, together with morphisms $p_i: X\rightarrow X_i$, with universal property: given any object $Y$ and morphisms $f_i:Y\rightarrow X_i$, there exists a unique morphism $f=\{ f_i\} :Y\rightarrow X$ with $p_if=f_i$.
Where does the motivation for this definition come from? How did people come up with it?
I don't see any natural way to go from Cartesian product (sets) or direct product of groups (groups) to this categorical definition.
If you look at Chs.7/8 of this (as yet very incomplete) Gentle Intro to Category Theory you'll find an extended discussion of the motivation for the categorical definition of products.
It's rather too long to repeat here, I'm sorry. But the basic approach is to note that the familiar pairing devices e.g. for constructing pairs via Kuratowski's device in set theory, or coding pairs by powers of primes in arithmetic, are obviously pretty arbitrary and there are loads of alternatives. But so what? These devices work in context. But ah, what does "it works" mean? Reflecting on that question tells us that what we need are matched coding-and-decoding functions which interact in certain ways. It's not so much what is "in" the pairs that matters as the pattern of morphisms in and out. Which is a rather categorical idea. Then we think how to implement in category theory proper. And lo and behold, we get the familiar categorical definition of products. But as I say, for the full dress version, see the Notes.