Derivative of $x^x$ using first principle

First, $$ \lim_{h\to0}\frac{x^h-1}{h}=y \iff x=\lim_{n\to\infty}\left(1+\frac yn\right)^n \iff x=e^y \iff y=\log(x) $$ Then, $$ \begin{align} &\lim_{h\to0}\frac{(x+h)^{x+h}-x^x}{h}\\ &=\lim_{h\to0}\frac{(x+h)^{x+h}-(x+h)^x+(x+h)^x-x^x}{h}\\ &=\lim_{h\to0}(x+h)^x\lim_{h\to0}\frac{(x+h)^h-1}{h} +x^x\lim_{h\to0}\frac{\left(1+\frac hx\right)^x-1}{h}\\ &=\lim_{h\to0}(x+h)^x\lim_{h\to0}\frac{(x+h)^h-1}{h} +x^x\lim_{h\to0}\frac{\left(1+\frac hx\right)^{\large\frac xhh}-1}{h}\\[12pt] &=x^x\log(x)+x^x\cdot\log(e)\\[16pt] &=x^x\log(x)+x^x \end{align} $$


To calculate the desired limit, one first has to know what is the meaning of the expression $x^x$. For some type of numbers, we can assume that we know how to calculate it, for example, $2^2=2\cdot2=4$.

On the other hand, what is $\pi^\pi$? Is it the product of $\pi$ by $\pi$, $\pi$ times? So we need a definition for the expression $x^x$. As @AlexP suggested in the comments, $x^x$ can be defined by $e^{x\log{x}}$.

Let's analyze this definition. The first thing to note is that to understand the definition, you have to know how to calculate the exponential of a real number, how to calculate the log of a real number and how to calculate the product of two real numbers. If we suppose that you know how to do all of this, then you know how to calculate $x^x$. Note that $x^x$ is defined only for $x>0$ (can you say why?).

Now, let's try to calculate the desired limit by using this definition.

\begin{eqnarray} \lim_{h\to 0}\frac{(x+h)^{x+h}-x^x}{h} &=& \lim_{h\to 0}\frac{e^{(x+h)\log{(x+h)}}-e^{x\log{x}}}{h} \nonumber \\ &=& \lim_{h\to 0}e^{x\log{x}}\frac{e^{(x+h)\log{(x+h)}-x\log{x}}-1}{h} \nonumber \\ &=& \tag{1}\lim_{h\to 0}e^{x\log{x}}\frac{e^{x\log{(1+h/x)}+h\log{(x+h)}}-1}{h} \end{eqnarray}

By using the definition of $e$ given by @Charles in the comments, we have that $$\tag{2}e^{x\log{(1+h/x)}+h\log{(x+h)}}-1=x\log{(1+h/x)}+h\log{(x+h)} \\+\frac{1}{2!}(x\log{(1+h/x)}+h\log{(x+h)})^2+...$$

Now, you can check that (for the first one try to use some fundamental limit)

$$\tag{3} \lim_{h\to 0}\frac{x\log{(1+h/x)}}{h^{1/n}} = \left\{ \begin{array}{cc} x &\mbox{ if $n=1$} \\ 0 &\mbox{ if $n>1$} \end{array} \right. $$

and

$$\tag{4}\lim_{h\to 0} \frac{h\log{(x+h)}}{h^{1/n}} = \left\{ \begin{array}{cc} \log{x} &\mbox{ if $n=1$} \\ 0 &\mbox{ if $n>1$} \end{array} \right. $$

By combining $(1)-(4)$ we conclude that $$\lim_{h\to 0}\frac{(x+h)^{x+h}-x^x}{h}=x^x(\log{x}+1)$$

Remark: How to justify the interchange of limits, i.e. if $f(h)=x\log{(1+h/x)}+h\log{(x+h)}$, how to justify $$\lim_{h\to 0}\lim_{n\to\infty}\sum_{k=1}^n\frac{f(h)^k}{k!}=\lim_{n\to \infty}\lim_{n\to 0}\sum_{k=1}^n\frac{f(h)^k}{k!}$$

First note that ($n\leq m$)

\begin{eqnarray} \left|\sum_{k=1}^n\frac{f(h)^k}{k!}-\sum_{k=1}^m\frac{f(h)^k}{k!}\right| &=& \left|\sum_{k=n}^m\frac{f(h)^k}{k!}\right| \nonumber \\ &\leq&\tag{5} \sum_{k=n}^m\frac{|f(h)|^k}{k!} \end{eqnarray}

Fix $\epsilon>0$ and choose $\delta>0$ such that $|f(h)|=\eta<1$ (note that this choice of $\delta$ depends on $x$, however $x$ is fixed) . It follow from $(5)$

$$\left|\sum_{k=1}^n\frac{f(h)^k}{k!}-\sum_{k=1}^m\frac{f(h)^k}{k!}\right|\leq\sum_{k=n}^m\frac{\eta^k}{k!}$$

From the last inequality and from the fact that $|f(h)|\to 0$ if $h\to 0$, we conclude that there exist $\overline{h}$ such that for all $0<h<\overline{h}$, the sum $\left|\sum_{k=1}^n\frac{f(h)^k}{k!}-\sum_{k=1}^m\frac{f(h)^k}{k!}\right|$ does not depends on $h$, i.e. the sum converges uniformly to $0$ as $h\to 0$. This implies that we can in fact interchange the limits.