The limit for f(g(x)) is not 0 ... it is 1. By constructing the composite function manually, it is clear that f(g(x)) = x+1 everywhere except x=0 and x=1. One can then easily see that the limit must be 1. However, since f is not continuous at 0, the composite rule, as it is written in the form given, cannot be applied.
It may be the case that $f(x)$ and $g(x)$ are discontinuous functions, but their composition $f\circ g(x)$ is continuous.
i.e. lets pick two of the craziest (and most famous) discontinuous functions.
Let $g(x)$ be Thome function
$g(x) = \begin{cases} \frac {1}{q} & x \text{ is rational with } x = \frac pq \text{ in lowest terms}\\0& x\text{ is irrational}\end{cases}$
let $f(x)$ be the Dirichlet function
$g(x) = \begin{cases} 0 & x \text{ is rational with }\\1& x\text{ is irrational}\end{cases}$
$f\circ g(x)$ is continous. But this is pretty unusual.
However if $g(x)$ is continuous at $c$ (as you say above, left hand limit at $c$ equals the right hand limit at $c$ equals $g(c)$) and $f(x)$ is continuous in the neighborhood of $g(c)$ then $f\circ g(x)$ is continuous at $c$ and $\lim_\limits{x\to c} f\circ g(x)$ exists (both left hand and right hand) and equals $f\circ g(c)$
What matters is continuity around $c$ (for $g$) and around $g(c)$ (for $f$). $f(x)$ and $g(x)$ might do crazy stuff outside of those neighborhoods.
Why are we allowed to do this.
We need to go to the $\epsilon-\delta$ definition of limits.
$g$ is continuous at $c$
$\lim_\limits{x\to c} g(x) = L$
$\forall \epsilon_1>0, \exists \delta_1>0: |x-c|<\delta_1\implies |g(x) - L|<\epsilon_1\tag{1}$
And $f$ is continuous at $L$
$$\forall \epsilon_2>0, \exists \delta_2>0: |x-L|<\delta_2\implies |f(x) - f(L)|<\epsilon_2$$
Setting $\epsilon_1 < \delta_2$ then $|f\circ g(x) - f\circ g(c)|<\epsilon_2$
We can do this because 1) is true for any $\epsilon.$
Best Answer
The theorem, as you stated it, is not true! Notice that for the function $f \circ g$ to be defined, the image of $g$ must be in the domain of $f$, and if $a$ is in the domain of $f$, it's not necessarly true that it' is in the domain of $g$. However, what is true is that if $f$ is continuous at $a$, and $g$ is continuous at $f(a)$, then $g \circ f$ is continuous at a.