Let $(B_t)$ a standard Brownian motion. So, it's a Martingale. Let $$\tau=\inf\{t\geq 0\mid B_t=1\}.$$ In particular, $$B_{\tau}=1\ \ a.s.,$$ therefore, we could expect that $\mathbb E[B_\tau]=1.$ But according to Optionnal stopping theorem this is $$\mathbb E[B_\tau]=\mathbb E[B_0]=0,$$ how can this be possible ?
We can apply optional stopping time theorem because taking $f\in \mathcal C_0^2(\mathbb R)$ s.t. $f(x)=x^2$ on $[0,1]$, we have by Dynkin formula $$\mathbb E[B_\tau^2]=\mathbb E\int_0^\tau \frac{1}{2}f''(u)du=\frac{1}{2}\mathbb E[\tau],$$ and thus $$\mathbb E[\tau]=2\mathbb E[B_\tau^2]=2<\infty .$$
As mentioned in the comments, the reason why we can't conclude $E[B_\tau] = 0$ is because $\tau$ doesn't have a finite expectation.
$$\begin{align*} \mathbb{E}\tau &= \int_0^\infty \mathbb{P}(\tau > t)\, dt = \int_0^\infty (1 - \mathbb{P}(\tau \leq t)\,dt \\ &= \int_0^\infty (1 - 2\mathbb{P}(B_t > 1))\,dt = \int_0^\infty \mathbb{P}(|B_t| \leq 1) \,dt = \int_0^\infty \mathbb{P}(|B_1| \leq 1/\sqrt{t})\,dt \\ &= \sqrt{\frac{2}{\pi}} \cdot \int_0^\infty \int_0^{1/\sqrt{t}} e^{-x^2/2}\,dx\,dt \\ &= \sqrt{\frac{2}{\pi}} \int_0^\infty \int_0^{1/x^2} e^{-x^2/2}\,dt\,dx = \sqrt{\frac{2}{\pi}} \int_0^\infty \frac{1}{x^2} e^{-x^2/2}\,dx \\ &= \mathbb{E}[Z^{-2}] = \infty \end{align*}$$ where $Z$ is a standard normal.
As a sidenote, the standard way to extract information from the optional stopping theorem for a stopping time with infinite expectation is to remember that the minimum of two stopping times is a stopping time, so we can take a sequence $\nu_t \to \infty$ of stopping times, each with finite expectation, and consider $\tau \wedge \nu_t$ instead. A common choice is the truncated stopping time $\tau \wedge t.$ In this case, doing so lets you evaluate $$\mathbb{E}\left[B_t \middle| \max_{0 \leq s \leq t} B_s < 1\right]$$