In the following picture, we see a proof of a statement for Borel-Cantelli lemma, where $(A_i)_{i\in \mathbb{N}}$ is a independent and $\sum P(A_i)=\infty$.
My doubt is on the use of the transformation $\exp(\log())$. Why can the author use it, when it can take the value $0$?

I would say it's fine to do so under the convention that $\log0:=-\infty$, $\exp(-\infty):=0$. Note that $\log(1-\mathbf P[A_n])\le0$ for all $n$, so we are summing elements from $[-\infty,0]$ which is perfectly allowable.
However, I would agree with Alex Provost that using $e^{-x}\ge1-x$ is better. In fact, this inequality is equivalent to the inequality $\log(1-x)\le-x$ which is used in the proof, so one wonders why they bothered with logarithms at all. The only reason I can think of is that people are generally more familiar with series than infinite products; many would rigorously study the latter for the first time in the context of complex analysis, in which
$$\prod_{n=1}^\infty a_n\text{ converges}\quad\Leftrightarrow\quad\sum_{n=1}^\infty\log(a_n)\text{ converges}$$
is well known.