What's actually the definition of the product of morphisms?

These are not equivalent definitions and they are defining two different morphisms, both of which are sometimes called the "product" of two morphisms. So, both are "correct" and the term "product" is ambiguous and you'll have to figure out which one is meant from context.

In practice, there is usually little chance of confusion, especially since the first construction is only defined when the two morphisms have the same domain. Personally, though, I would recommend calling the first definition the "tupling" of $f_1$ and $f_2$ rather than the "product" and reserve the term "product" for the second definition.


The second is an instance of the first. Given maps $f_1: Y_1 \to X_1$ and $f_2: Y_2 \to X_2$ we can form the composites $$ Y_1 \times Y_2 \stackrel{p_i}{\longrightarrow} Y_i \stackrel{f_i}{\longrightarrow} X_i. $$ Now use the universal mapping property of the product to construct the map $$ \langle f_1 \circ p_1, f_2 \circ p_2 \rangle: Y_1 \times Y_2 \to X_1 \times X_2. $$ This map is your $f_1 \times f_2$. Both are constructions involving products, just in a different set-up. The first thing you cited is the universal mapping property defining the product $X_1 \times X_2$. The second is an application of it.