Show that the function $f(x)=e^{-\frac{1}{x}},\text{ if }x>0\wedge f(x)=0,\text{ if }x\leq 0$ is smooth and all derivatives vanish in $x=0$

The problem with your substitution is that the function $g(x)=1/x$ "blows up" at $x=0.$ You can avoid this problem by calculating the derivative directly. In the Wiki page cited in the comments, they use the Maclaurin expansion for $e^x$. You can also find the derivative using L'Hospital's Rule (to get the penultimate equality):

$\lim_{x \to 0^+} \frac{f(x) - f(0)}{x - 0} = \lim_{x \to 0^+} \frac {e^{-1/x}}x = \lim_{x \to 0^+} \frac {1/x}{e^{1/x}} = \lim_{x \to 0^+} \frac 1 {e^{1/x}} = 0$

and then of course, we have, using the definition of $f$,

$\lim_{x \to 0^-} \frac{f(x) - f(0)}{x - 0} = \lim_{x \to 0^-} \frac {0}x =0 $

so we conclude that $f'(0)=0.$

Now it's not hard to show by induction that all derivatives vanish at $x=0.$