I'm working with additve categories.
I know that if instead of the product you consider a morphism from the coproduct $\oplus_{i\in I}X_i\rightarrow Y$, the answer is "yes", because $\text {Hom}(\oplus_{i\in I}X_i, Y)=\prod_{i\in I}\text {Hom}(X_i, Y)$. But the product does not commute with $\rm Hom$ in the first variable, so I suppose the answer to my question is negative.
Can anyone provide me a counterexample?
I will give a counterexample in the category of abelian groups.
Let $X_n$ be the cyclic group of order $p_n$, where $p_n$ is the $n$-th prime number. We can consider $\bigoplus_n X_n$ as a subgroup of $\prod_n X_n$ in the obvious way. Let $Y$ be the quotient of $\prod_n X_n$ by $\bigoplus_n X_n$. Then $Y$ is a torsion-free abelian group. Each $X_n$ is torsion, so every homomorphism $X_n \to Y$ is zero. But there is certainly a non-zero – even surjective! – homomorphism $\prod_n X_n \to Y$.