In my one of lecture notes, there are two definitions of infinite Cartesian product, and it reads that we can construct a unique bijection between them.
One way to define an infinite Cartesian product $\prod_{i \in I}X_i$ of a family of sets $\{X_i\}_{i \in I}$ is as follows:
$\prod_{i \in I}X_i=\{f:I\rightarrow \bigcup_{i\in I} X_i : f(i)\in X_i\}$
On the other hand, another way to define an infinite Cartesian product of a family of sets is as follows:
We could have defined $\prod_{i \in I}X_i$ as a set together with a family of maps $\{p_j : \prod_{i \in I}X_i\rightarrow X_j\}_{j\in I}$ having the universal property.
Now, in the lecture note, the universal property is as follows:
Given any set $Z$ and any family of maps $\{g_i : Z\rightarrow X_i\}_{i\in I}$, there exists a unique function $g:Z\rightarrow \prod_{i \in I}X_i$ such that $g_i=p_i\circ g$ for all $i\in I$.
But, I think in order to prove that there is a unique bijection between the two different infinite Cartesian products as defined above, we need another assumption that a family of maps $\{p_j : \prod_{i \in I}X_i\rightarrow X_j\}_{j\in I}$ mentioned at the first quote has to be a family of canonical projections such that $p_j(x)=x(j)$ where $x$ is a function from $I$ to $\bigcup_{i\in I}X_i$ such that $x(i)\in X_i$.
So, will we need this new assumption, or not? If not, could somebody give a proof for it?
Here is how the universal property should be used.
First, the universal property should be stated abstractly in the following manner. I'll use a different abstract letter for the universal property, since by using the letter $Z$ in the comments I think that I just created confusion.
Next, one should prove that the universal property does indeed hold for the set $Q=\Pi_i X_i$ and the family of maps $q_i = p_i$ where $p_i(f)=f(i)$ is the standard projection function onto $X_i$. To do this, suppose that $Z$ is any set and $\{g_i : Z \to X_i\}_{i \in I}$ is any family of maps. Define the map $h : Z \to \Pi_i X_i$ by $h(z) = f$ where $f(i) = g_i(z)$, check that indeed $p_i \circ h = g_i$. Also check uniqueness: if $h' : Z \to \Pi_i X_i$ satisfies $\pi_i \circ h' = g_i$ then $h'(z)$ must satisfy $h'(z)(i) = g_i(z)$, which determines $h=h'$ uniquely.
Now there is an abstract argument which is the same for almost any situation where you have a universal property. In this particular situation the abstract argument goes like this:
We conclude that $h$ and $h'$ are inverse functions of each other and so each is a bijection. (I've always been impressed by how this argument uses four different applications of the universal property).
So, how does this apply to your question regarding two different cartesian products according to the second definition, and the possible need for a new assumption?
The trouble with your question is that you have not stated the second quote (the definition of a set with a family of maps satisfying the universal property) in the correct level of abstraction. That is why, in my discussion above, I have separated out the abstract statement of what a set with a family of maps satisfying the universal property means from the proof that the given set $\Pi_i X_i$ from the first definition with the given standard projections functions $p_i : \Pi_i X_i \to X_i$ does indeed satisfy the universal property (your first definition of $\Pi_i X_i$ is correct).
So, for instance, you could take $Q = \Pi_i X_i$, and you could take $q_i : \Pi_i X_i \to X_i$ to be some totally weird collection of functions, not the standard projection functions, as long as it satisfies the universal property. For example, pick a bijection $\sigma : \Pi_i X_i \to \Pi_i X_i$ and define $q_i = p_i \circ \sigma$. This choice of $Q$ and of maps $q_i$ does indeed satisfy the universal property, as you can check. And so there does indeed exist a unique bijection $h : \Pi_i X_i \to \Pi_i X_i$ that satisfies $p_i \circ h = q_i$. And in fact we know that bijection has to be, namely $\sigma$.
I hope this helps. Getting the right level of abstraction straight when trying to understand universal properties can be a head banger.