By the Nash Embedding Theorem, $f(n)\le \tfrac12n(3n+11)$.
Here's an idea of a way to show that $f(n)\le n(n{+}1)$ by constructing an explicit isometric embedding: Let $\mathbb{T}^n = \mathbb{R}^n/L$ where $L\subset\mathbb{R}^n$ is a lattice and $\mathbb{R}^n$ is endowed with the usual inner product and the standard Riemannian metric $g=\mathrm{d}x\cdot\mathrm{d} x$.
Let $L^*\subset\mathbb{R}^n$ be the dual lattice, i.e., the set of vectors $\xi\in \mathbb{R}^n$ such that $\xi\cdot x$ is an integer for all $x\in L$. Now choose $N = \tfrac12n(n{+}1)$ elements $\xi_1,\ldots,\xi_N$ that generate $L^*$ and $N$ nonnegative constants $r_1,\ldots, r_n$ and define a map $\Phi: \mathbb{T}^n\to \mathbb{C}^N\simeq \mathbb{R}^{n(n+1)}$
$$
\Phi(x) = \frac1{2\pi}\bigl(\sqrt{r_1}\,\mathrm{e}^{2\pi i\,\xi_1\cdot x},\ldots,
\sqrt{r_N}\,\mathrm{e}^{2\pi i\,\xi_N\cdot x}\bigr).
$$
Because of the hypothesis about the set $\xi_1,\ldots,\xi_N$, it follows that $\Phi$ is a well-defined injection, provided that the $r_i$ are all positive, and moreover it follows that, giving $\mathbb{R}^{n(n{+}1)} = \mathbb{C}^N$ the standard product metric with each copy of $\mathbb{C}$ given its standard metric, the metric pulled back by $\Phi$ is of the form $\mathrm{d}x\cdot G\,\mathrm{d}x$ where $G$ is the symmetric positive definite constant $n$-by-$n$ matrix
$$
G = {r_1}\,\xi_1\,\xi_1^T + \cdots + {r_N}\,\xi_N\,\xi_N^T.
$$
In particular, the induced metric on the image of $\Phi$ is flat.
Now, if it's possible to choose the $\xi_1,\ldots,\xi_N$ in $L^*$ so that a multiple of the identity matrix $I_n$ is in the convex hull of the $N$ rank 1 positive semi-definite symmetric matrices
$$
\xi_1\,\xi_1^T,\ \ldots,\ \xi_N\,\xi_N^T,
$$
then one can choose the $r_i\ge0$ so that $\Phi$ will be an isometric embedding.
This is trivial when $n=1$ (of course, $f(1) = 2$), and not difficult when $n=2$: After a rotation in $\mathbb{R}^2$, we can assume that $L^*$ is generated by $\xi_1 = (a,0)$ and $\xi_2 = (b,c)$ where $a>0$ and $c>0$ and $b^2+c^2>a^2$ and $0\le b\le \tfrac12 a$. Then, taking $\xi_3 = (b-a,c) = \xi_2-\xi_1$ works. Thus, $4\le f(2)\le 6$.
I'm pretty sure that I have a method for choosing $\xi_1,\ldots ,\xi_6$ when $n=3$ that works, but the details are messy. Probably, there's a cleaner way to do it.