What is the behaviour of the first $n$ digits of ${\underbrace{99\dots99}_{n\text{ nines}}}^{\overbrace{99\dots99}^{n\text{ nines}}}$ as $n\to\infty$

I figured it out: We can indeed study the asymptotic behaviour of $f(n)$ using Taylor series:

Observe that $$\log_{10}(y_n)=(10^n-1)\cdot\log_{10}(10^n-1).$$ When I first saw this, I was tempted to write $$\log_{10}(y_n)=(10^n-1)\cdot\log_{10}(10^n-1)\approx(10^n-1)\cdot n.$$

Although this approximation is very tight, I am still making an error big enough such that the first $n$ digits of $10^{\text{approximation}}$ are completely different from those of $y_n$. (Indeed, the approximation just yields an integer power of $10$.)

However, there is an easy way to quantify the error in this approximation:

\begin{split}\log_{10}(y_n)&=(10^n-1)\cdot\left(\color{orange}{\log_{10}(10^n)}+\log_{10}(10^n-1)-\color{orange}{\log_{10}(10^n)}\right)\\ &=(10^n-1)\cdot\left(n+\log_{10}\left(1-\frac1{10^n}\right)\right)\\ &=(10^n-1)\cdot\left(n-\frac{10^{-n}}{\ln(10)}+O(10^{-2n})\right)\\ &=10^n n-\frac1{\ln(10)}-n+O(10^{-n}), \end{split}

where I am using the big $O$ notation as $n\to\infty$. (The second last equality is a series of the logarithm.)

It follows that $$y_n=10^{\log_{10}(y_n)}=10^{10^n n-n}\cdot 10^{-\frac1{\ln(10)}}\cdot10^{O(10^{-n})}.$$

Notice that $$10^{-\frac1{\ln(10)}}=\exp\left(-\frac{\ln(10)}{\ln(10)}\right)=\frac1e,$$ and that $10^{O(10^{-n})}$ converges to $1$ very quickly (in fact, the speed of convergence doesn't matter, $10^{O(10^{-n})}$ could be replaced by any function that converges to $1$.) So for $n$ large enough, we have $\frac1e 10^{O(10^{-n})}\in]0,1[$.

Since $10^{10^n n-n}$ is an integer power of $10$, it follows that the first $n$ digits of $y_n$ are $$\bbox[15px,border:1px groove navy]{f(n)=\left\lfloor \frac{10^n}{e}\cdot10^{O(10^{-n})}\right\rfloor.}$$

A corollary of this result is that $$\lim_{n\to\infty} \frac{f(n)}{10^n}=\frac1e.$$

Remark 1. We don't have to consider the first $n$ digits only. For example, we also have $$\lim_{n\to\infty} \frac{y_n}{10^{10^n-n}}=\frac1e$$ and I think that we could verbatim look at for example the first $2n$ digits of $y_n$. (Or, more generally, at the first $d(n)$ digits where $d(n)$ is a sequence of natural numbers that converges to $\infty$.)

Remark 2. My procedure indicates a rather rapid convergence: Indeed we have $10^{O(10^{-n})}=\exp(O(10^{-n})\ln(10))=1+O(10^{-n})$ so that $10^{O(10^{-n})}-1$ has an asymptotic error that behaves like $10^{-n}$.

Here is a plot of the ratio of $y_n$ and the approximation given above (i.e. this is a plot of the $10^{O(10^{-n})}$ term):

enter image description here


(Short version of Maximilian Janisch's answer)

We have $$x_n:=\bigl(10^n-1)^{10^n -1}=\bigl(10^n)^{10^n -1}\>z_n$$ with $$z_n:=\bigl(1- 10^{-n}\bigl)^{10^n}\cdot\bigl(1-10^{-n}\bigr)^{-1}\ \to\ {1\over e}\cdot 1\qquad(n\to\infty)\ .$$ As $x_n$ and $z_n$ have the same first digits in base $10$ it follows that in the limit the first digits of $x_n$ are the first digits of ${1\over e}$, namely $367879\ldots \ $.