For now, we will not add the single dot in the center.
Let $f(n)$ be the formula for the number of dots of the $n$th hexagon. Keep in mind that this is not the centered hexagonal number yet.
Notice that there are always six dots for each hexagon. Also, notice that for the $n$th hexagonal number, in a particular side excluding the vertices, there are $n - 1$ dots. Since hexagons have six sides, we have $6n - 6$ dots.
Hence, we have
\begin{align*}
f(n) &= 6n - 6 + 6 \\
f(n) &= 6n
\end{align*}
Now, let $P(n)$ be the centered hexagonal number without the single dot in the center. We can see that $$P(n) = f(0) + f(1) + f(2) + \cdots + f(n).$$ Simplifying the right-hand side in terms of $n$,
\begin{align*}
P(n) &= f(0) + f(1) + f(2) + \cdots + f(n) \\
P(n) &= 6(0) + 6(1) + 6(2) + \cdots + 6n \\
P(n) &= 6(0 + 1 + 2 + \cdots + n) \\
P(n) &= 6\left(\frac{n(n + 1)}{2}\right) \\
P(n) &= 3n(n + 1)
\end{align*}
Adding the dot in the center, we now have $P(n) = 3n(n + 1) + 1$. In this formula, the dot is also a hexagon, although its "size" makes it essentially a point. Since we are looking for the 12th hexagonal number, by replacing $n$ by $11$ (since the $+1$ is the $12$th hexagonal number), we get $397$.