As requested, I will write the proof given in the link in more depth.
Let $n=p_1^{\alpha _1}\cdots p_k^{\alpha _k}$, where the $p_i$'s are distinct primes, then observe that $\gcd (a,n)=1$ if and only if $\gcd \left (a,p_i^{\alpha _i}\right )=1$ for all $i=1,\ldots ,k$. Hence, the number of positive integers less than or equal to $n$ that are relatively prime with $n$ is the number of solutions of the system of congruence equations when each $b_i$ runs through the integers less than or equal to $p_i^{\alpha _i}$ that are relatively prime with $p_i^{\alpha _i}$. The Chinese Remainder Theorem states that there is exactly one solution for each system, therefore, the number of positive integers less than or equal to $n$ that are relatively prime with $n$ is the same as the number of systems of congruence equations when each $b_i$ runs through the integers less than or equal to $p_i^{\alpha _i}$ that are relatively prime with $p_i^{\alpha _i}$. Each $b_i$ has $\varphi \left (p_i^{\alpha _i}\right )$ possible values, hence the number of such systems is $\prod \limits _{i=1}^k\varphi \left (p_i^{\alpha _i}\right )$, therefore$$\varphi (n)=\prod \limits _{i=1}^k\varphi \left (p_i^{\alpha _i}\right )$$because both equal the number of positive integers less than or equal to $n$ that are relatively prime with $n$.
Finally, if $\gcd (m,n)=1$, then they don't have any prime factors in common, hence, if $n=p_1^{\alpha _1}\cdots p_k^{\alpha _k}$, where the $p_i$'s are distinct primes, and $m=p_{k+1}^{\alpha _{k+1}}\cdots p_{k+r}^{\alpha _{k+r}}$, where the $p_i$'s are distinct primes, then $nm=\prod \limits _{i=1}^{k+r}p_i^{\alpha _i}$, and$$\varphi (nm)=\prod \limits _{i=1}^{k+r}\varphi \left (p_i^{\alpha _i}\right )=\left (\prod \limits _{i=1}^k\varphi \left (p_i^{\alpha _i}\right )\right )\left (\prod \limits _{i=k+1}^{k+r}\varphi \left (p_i^{\alpha _i}\right )\right )=\varphi (n)\varphi (m)$$and we are done.