How to perform arithmetic for a node in TikZ?

You need first to calculate value of the \x+1+5*\y and than use result as content of the node:

\documentclass[tikz, margin=3mm]{standalone}

\begin{document}
    \begin{tikzpicture}
\foreach \x in {0,...,4}
    \foreach \y in {0,...,4}
    \pgfmathtruncatemacro{\xy}{\x+1+5*\y} % macro which calculate value of \x+1+5*\y
        \draw (\x*8-1,\y*8+1) rectangle (\x*8+1,\y*8-1) node[midway] {\xy};
    \end{tikzpicture}
\end{document}

enter image description here

For use of the pgfmath library (it is loaded by default) see chapter Mathematical and Object-Oriented Engines, pp 1010 in tikz documentation (version for 4.1.4a), particular section 94.1 Parsing Expressions on page 1012.