The definition of \textbackslash when the OT1 encoding is used is
\OMS-cmd \textbackslash \OMS\textbackslash
Both the first and the third token can't be typed by a user without some devious trick. However, the definition of \OMS-cmd is equivalent to
\def\OMS-cmd#1#2{%
\ifx\protect\@typeset@protect
\@inmathwarn #1%
\expandafter\ifx\csname\cf@encoding\string#1\endcsname\relax
...<omitted irrelevant things>...
}
The macro \@inmathwarn is responsible for the warning
Command \textbackslash invalid in math mode
After that the macro \OMS\textbackslash is expanded. If we were in text mode, the command would do a font change in a group, selecting a font in the OMS encoding (math symbols), doing
\char"6E
and a backslash would appear, because that's what an OMS encoded font has at slot "6E (hexadecimal).
If we're in math mode, the same \char"6E instruction would be performed, but here the font change has no effect. So we get the character at position "6E in the font in math family 0, where an n is found. When \char"6E is found in math mode, TeX does as if it were \mathchar"006E and in family 0, slot "6E there's an n (it's the upright text font and the ASCII code of n is exactly "6E).
Things are different in the T1 encoding, because in this case the definition of \textbackslash is
\T1-cmd \textbackslash \T1\textbackslash
and the latter macro eventually expands to \char"5C. In a text font, T1 encoding, at slot "5C there's actually a backslash.
Here's the explanation. Now, some advice:
Never underestimate warnings and
never use \text... symbol commands in math mode (don't mistake them with \textrm, \textit or similar, which are obviously legal in math mode).