You stumbled upon a classic counterexample to the "theorem"
$f\colon \mathbb{R} \to \mathbb{R}$ has an horizontal asymptote if and only if $f'(x) \to 0$ as $x\to \infty$.
Now, your function $f(x) = \log(1+x^2)$ is a counterexample to the "$\Leftarrow$" implication, since $\lim_{x\to \infty} f(x) = + \infty$. This can be shown by many means; but let's try with the definition, which is $\forall \varepsilon > 0$ there exist a $\delta > 0$ such that $\left| \log(1+x^2) \right| > \varepsilon$ if $x > \delta$.
Now, $\log(1+x^2) > \varepsilon$ means that $x^2 > e^\varepsilon -1$; so we only have to take $\delta = \sqrt{e^\varepsilon -1}$ to see that if $x > \delta = \sqrt{e^\varepsilon -1}$, then $\log(1+x^2)> \varepsilon$.
What about the other direction, "$\Rightarrow$"? Well, that is an actual theorem and we can prove it:
to have an horizontal asymptote means to have a finite limit at infinity. Let's now remember that the tangent to the graph of a function is the line $y = f(x_0) + f'(x_0)(x-x_0)$; if $y = c$ is an horizontal asymptote for $f$, then it must be tangent to the graph of $f(x)$ "at infinity". So now $c = c + \lim_{x_0 \to \infty} f'(x_0)(x-x_0)$, from which we conclude that $\lim_{x_0 \to \infty} f'(x_0) = 0$.
edit: of course for all this to be true we must have that $\lim_{x \to \infty} f'(x)$ must exist, otherwise we can't prove anything as a comment points out.