Let $f(x)=|x^3|$.
I found two ways to differentiate this function. Apparently method 2 is wrong, but I cannot figure out why. So the question is, is method two wrong and why?
Method 1 (according to wolfram mathematica)
$$f(x)=|x^3|=|x|^3$$
$$f'(x)=3|x|^2 \text{Sgn}(x)=3|x^2|\frac{x}{|x|}=3|x|x$$
Method 2 (using chain-rule)
$$f'(x)= \text{Sgn}(x^3)\cdot3x^2$$
With method 2 it seems $f'(0)$ is not defined, since $\text{Sgn}(0)$ is not defined. However, this is not true according to WolframAlpha.
This is a nice question as it highlights an important subtlety in the chain rule, although it's a subtlety that comes up rarely. The chain rules tells us that $$ \frac{d}{dx} (f \circ g)(a) = f'(g(a)) \cdot g'(a), $$ provided that $g$ is differentiable at $a$ and $f$ is differentiable at $g(a)$.
It may happen that $f \circ g$ is differentiable at $a$ even if one of these hypotheses does not hold. This question is an example. Here, $g(x) = x^3$ and $f(x) = |x|$. Since $f$ is not differentiable at $g(0) = 0$, the hypotheses of the chain rule do not apply at $0$ and it is illegitimate to use it to conclude anything about the derivative there. Therefore, you must find another way. As you see, when we compute in the other direction, we see that in fact the derivative exists at the origin and is zero.