I am currently looking into the Lambert W function. From my understanding it is defined as: $$f(x)=xe^x$$ $$W(x)=f^{-1}(x)$$ So in the application of this I am trying to define the inverse of the function $y=x^x$. This is my working: $$y=x^x$$ $$\ln(y)=x\ln(x)=e^{\ln(x)}\ln(x)$$ and this fits the form $f(u)=ue^u$
Now I can say that: $$\ln(x)=W\left[\ln(y)\right]$$ $$\therefore x=e^{W\left[\ln(y)\right]}$$
Is this working correct and give the right answer?
Your derivation is correct.
Consider that your $f^{-1}$ is the inverse relation but not an inverse function.
The functions $\mathbb{R}\to\mathbb{R},x\mapsto xe^x$ and $\mathbb{C}\to\mathbb{C},x\mapsto xe^x$ are not injective. In $\mathbb{R}$, $xe^x$ has the minimum $(-1,-\frac{1}{e})$. $W$ is therefore indeed the inverse relation, but not a function and therefore not an inverse function. See e.g. the top figure in Wikipedia: Lambert W function.
We have:
$$y=x^x$$
$$y=e^{x\ln(x)}$$
We cannot simply apply the $\ln$-function to the equation because $\ln(e^z)=z$ is valid only for $-\pi<\text{Im}(z)\le\pi$ (see e.g. [Abramowitz/Stegun 1970] p. 69 4.2.3).
Because the complex function $\exp$ is periodic, it is not injective and its inverse relation is not a function. The inverse relation of $\mathbb{C}\to\mathbb{C},z\mapsto e^z$ is $z\mapsto\text{Ln}=\ln(z)+2k\pi i$ ($\forall k\in\mathbb{Z}$) $\ \ $ (see e.g. [Abramowitz/Stegun 1970] p. 67 4.1.5).
$\text{Ln}(e^z)=z+2k\pi i$ ($\forall k\in\mathbb{Z}$) $\ \ $ (see e.g. [Abramowitz/Stegun 1970] p. 69 4.2.2).
$$y=e^{x\ln(x)}\tag1$$
$$\text{Ln}(y)=\text{Ln}(e^{x\ln(x)})$$
Because both arguments are equal (acc. to equation (1)), we have to choose the same branch of Ln on both sides of the equation:
$$\ln(y)+2k\pi i=x\ln(x)+2k\pi i\ (\forall k\in\mathbb{Z})$$
$$\ln(y)=x\ln(x)$$
$$...$$
$\ $
[Abramowitz/Stegun 1970] Abramowitz, M.; Stegun, I.: Handbook of Mathematical Functions with Formulas, Graphs, and Mathematical Tables. National Bureau of Standard 1970