\pgfmathparse evaluates to a float number: 1.0, 2.0, ...
Then, you get below = of n1.0. The .0 is an border anchor, meaning the border at an angle of 0°, the same as n.east. This explains the shift to the right. The lower node's center is placed below the upper node's right side.
The .0 can be stripped by \pgfmathtruncatemacro, for example:
\documentclass[tikz]{standalone}
\usetikzlibrary[positioning]
\begin{document}
\begin{tikzpicture}
\node (n1){First};
\foreach \x in {2,...,6}{%
\pgfmathtruncatemacro{\lastx}{\x - 1}
\node [below = of n\lastx](n\x) {\x};
}
\end{tikzpicture}
\end{document}
An alternative is key remember in the \foreach loop to remember the previous value without the need to calculate it:
\documentclass[tikz]{standalone}
\usetikzlibrary[positioning]
\begin{document}
\begin{tikzpicture}
\node (n1){First};
\foreach \x [remember=\x as \lastx (initially 1)] in {2,...,6}{%
\node [below = of n\lastx](n\x) {\x};
}
\end{tikzpicture}
\end{document}
rememberis precisely what I want! I was trying to do it myself with\defbut that obviously doesn't work. Thanks for the explanation too. – Seamus May 28 '22 at 10:10