I think what you are referring to is Euler's product formula for the zeta function $\zeta(z)$ at z=1. Where
$$\zeta(z) = \sum_{n=1}^{\infty}\frac{1}{n^z}$$
the proof is as follows,
$$\zeta(z) = 1 + \frac{1}{2^z}+ \frac{1}{3^z}+ \frac{1}{4^z}+...$$
$$\frac{1}{2^z}\zeta(z) = \frac{1}{2^z}+ \frac{1}{4^z}+ \frac{1}{6^z}+...$$
we can subtract the second equation from the first and we get that
$$\zeta(z)-\frac{1}{2^z}\zeta(z) = \zeta(z)\left(1-\frac{1}{2^z}\right) = \frac{1}{3^z}+ \frac{1}{5^z}+ \frac{1}{7^z}+\frac{1}{9^z}+...$$
we can repeat this by factoring out the next term
$$\frac{1}{3^z}\left(1-\frac{1}{2^z}\right)\zeta(z) = \frac{1}{3^z}+ \frac{1}{9^z}+ \frac{1}{15^z}+\frac{1}{21^z}+...$$
we can subtract again and we get that
$$\left(1-\frac{1}{3^z}\right)\left(1-\frac{1}{2^z}\right)\zeta(z) = \frac{1}{5^z}+ \frac{1}{7^z}+ \frac{1}{11^z}+\frac{1}{13^z}+...$$
everytime we do this you can see that we are removing all terms of the series with factors of 2, 3,... and so on. What is left behind will be all terms that don't factor i.e prime numbers. This will be all terms of the form $\frac{1}{p^z}$ for a prime $p$.
When reapeated infinitely we get
$$\left(1-\frac{1}{2^z}\right)\left(1-\frac{1}{3^z}\right)\left(1-\frac{1}{5^z}\right)\left(1-\frac{1}{7^z}\right)...\zeta(z) = 1$$
In your case $z=1$
so we have,
$$\left(1-\frac{1}{2}\right)\left(1-\frac{1}{3}\right)\left(1-\frac{1}{5}\right)\left(1-\frac{1}{7}\right)...\zeta(1) = 1$$
which can be written as
$$\zeta(1)\prod_{i=1}^{\infty}1-\frac{1}{p_i} = 1$$
$$\zeta(1)= \prod_{i=1}^{\infty}\frac{1}{1-\frac{1}{p_i}}$$
and since
$$\zeta(1) = 1 + \frac{1}{2}+ \frac{1}{3}+ \frac{1}{4}+...$$
we get that
$$\zeta(1)= \prod_{i=1}^{\infty}\frac{1}{1-\frac{1}{p_i}} = 1 + \frac{1}{2}+ \frac{1}{3}+ \frac{1}{4}+...$$