The problem states:
(1) $x$ is fixed, possibly from $\mathbb{R}$
(2) $n$ ranges over all $\mathbb{N}$. In other words, $n$ can be any natural number.
(3) Assume $n^x\in\mathbb{Q}$. By (2), the condition $n^x\in\mathbb{Q}$ must hold for all natural $n$.
(4) Then necessarily one must conclude $x\in\mathbb{Z}$
An elementary proof that uses only the Fundamental Theorem Of Arithmetics is as follows:
Let $a,b\in\mathbb{N}$ be some naturals at our disposal. Then the assumption (3) states:
$n^x=\frac{a}{b}$
Denote prime factors of $a$ by $P_a$ with multiplicities $p_a$. This way one can write $a$ in the form
$a=\prod P_a^{p_a}$
Similarly, define primes $P_b$ along with multiplicities $p_b$ so that
$b=\prod P_b^{p_b}$
This is just the Fundamental Theorem Of Arithmetics. Do notice that multiplicities are natural numbers.
Number $n$ can be any natural number. The result must hold for all $n$. So assume $n$ is prime itself. Say, $n=2$.
The assumption (3) now reads
$\prod P_b^{p_b} 2^{x}=\prod P_a^{p_a}$
If $x$ was real, one could write it as a sum of its integer part $\left[x\right]$ and its fractional part $\left\{x\right\}$ as $x=\left[x\right]+\left\{x\right\}$. Do notice that the fractional part $\left\{x\right\}$ is less than $1$ and positive.
The assumption (3) now becomes
$\prod P_b^{p_b} 2^{\left[x\right]}2^{\left\{x\right\}}=\prod P_a^{p_a}$
There is nothing wrong with the factor $2^{\left[x\right]}$ -- it is of the form "prime to some integer power". However, the factor $2^{\left\{x\right\}}$ makes no sense -- it would break the Fundamental Theorem Of Arithmetics unless $2^{\left\{x\right\}}$ was itself of the form "prime to some integer power". Do notice that the right hand side is a natural number -- hence so is the product on the left hand side. However, $2^{\left\{x\right\}}$ is less than $2$ and it cannot be written in the form "prime to some integer power". This contradicts the Fundamental Theorem Of Arithmetics.
Hence one concludes that $x$ must be an integer -- with no fractional part.