The other solution uses class field theory. I will avoid that here.
Your question is the same as asking when $\mathbf Q(\sqrt{n}) \subset \mathbf Q(\omega_m)$.
By replacing $n$ by is biggest squarefree factor, we can assume $n$ is squarefree. And surely you are not interested in $n$ being a square, so we take $n$ to be a squarefree integer other than $1$. When $\mathbf Q(\sqrt{n}) \subset \mathbf Q(\omega_m)$, primes that ramify in the quadratic field also ramify in the cyclotomic field.
When $n$ is squarefree and not $1$, which primes ramify in $\mathbf Q(\sqrt{n})$? An odd prime ramifies in $\mathbf Q(\sqrt{n})$ if and only if it divides $n$, while $2$ ramifies in $\mathbf Q(\sqrt{n})$ if and only if $n \equiv 2, 3 \bmod 4$.
Which primes ramify in $\mathbf Q(\omega_m)$? When $p \nmid m$, $p$ is unramified in $\mathbf Q(\omega_m)$ since $x^m - 1 \bmod p$ is separable. When $p \mid m$ and $p > 2$, $p$ is ramified in $\mathbf Q(\omega_p)$, so $p$ is ramified in the larger field $\mathbf Q(\omega_m)$. When $m$ is divisible by $2$ just once, $2$ is unramified in $\mathbf Q(\omega_m)$ since this field equals $\mathbf Q(\omega_{m/2})$ and $m/2$ is odd. When $4 \mid m$, $2$ is ramified in $\mathbf Q(i)$ and thus also in the larger field $\mathbf Q(\omega_m)$.
By looking at ramified primes, if $\mathbf Q(\sqrt{n}) \subset \mathbf Q(\omega_m)$ then every odd prime factor of $n$ is a factor of $m$, so when $n$ is odd we have $n \mid m$ (because $n$ is squarefree). When $n \equiv 3 \bmod 4$, also $2$ ramifies in $\mathbf Q(\sqrt{n})$, so $4 \mid m$, and thus $4n \mid m$.
I am going to look only at odd $n$ for simplicity. A necessary condition to have $\mathbf Q(\sqrt{n}) \subset\mathbf Q(\omega_m)$ is then
$n \mid m$ when $n \equiv 1 \bmod 4$ and $4n \mid m$ when $n \equiv 3 \bmod 4$.
Now we want to prove the converse: if $n$ is odd with $n \mid m$ when $n \equiv 1 \bmod 4$ and $4n \mid m$ when $n \equiv 3 \bmod 4$, then
$\mathbf Q(\sqrt{n}) \subset \mathbf Q(\omega_m)$.
When $n = -1$ this is immediate: $4 \mid m$ and $\mathbf Q(\sqrt{n}) = \mathbf Q(i)\subset \mathbf Q(\omega_m)$. Now let $n$ be odd and not be $\pm 1$, so $n$ has prime factors.
Write $n = \pm p_1\cdots p_r$ where the $p_i$'s are distinct odd primes.
In order to show $\sqrt{n} \in \mathbf Q(\omega_m)$, we're going to show $\sqrt{\pm p_i} \in \mathbf Q(\omega_m)$ for a careful choice of signs on each prime and then multiply together those square roots to show $\sqrt{n} \in \mathbf Q(\omega_m)$.
To handle signs nicely, it is convenient to consider, when $n$ is odd, the odd number $n^* = (-1)^{(n-1)/2}n$. So $n^* = \pm n$ with $n^* \equiv 1 \bmod 4$. Check $(-n)^* = -(n^*)$. Thus $(\varepsilon n)^* = \varepsilon (n^*)$ when $\varepsilon = \pm 1$. Also check $(n_1n_2)^* = n_1^*n_2^*$ when $n_1$ and $n_2$ are odd.
Let the prime factorization of $n$ be $\varepsilon p_1\cdots p_r$ where $\varepsilon = \pm 1$ and the $p_i$'s are distinct odd primes. Then $\varepsilon n = p_1\cdots p_r$, so
$(\varepsilon n)^* = p_1^*\cdots p_r^*$. Since $(\varepsilon n)^* = \varepsilon n^*$,
$$
n^* = \varepsilon p_1^*\cdots p_r^*.
$$
Case 1: $n \equiv 1 \bmod 4$, so $n \mid m$. Then $n^* = n$, so $n = p_1^*\cdots p_r^*$.
Thus $\sqrt{p_1^*}\cdots\sqrt{p_r^*}$ is a square root of $n$. Using Gauss sums, $\sqrt{p^*} \in \mathbf Q(\omega_p)$ when $p$ is an odd prime. (Explicitly, $(\sum_{k=1}^{p-1} (\frac{k}{p})\omega^k)^2 = p^*$, so the Gauss sum $\sum_{k=1}^{p-1} (\frac{k}{p})\omega^k$ is a square root of $p^*$ and its very formula shows it is in $\mathbf Q(\omega_p)$.) When $n \equiv 1 \bmod 4$, each $\sqrt{p_i^*}$ is in $\mathbf Q(\omega_{p_i})$, which is in $\mathbf Q(\omega_m)$, so their product $\sqrt{n}$ is in $\mathbf Q(\omega_m)$.
Case 2: $n \equiv 3 \bmod 4$, so $4n \mid m$. Then $i \in \mathbf Q(\omega_m)$. We have $n^* = -n$, so $-n = p_1^*\cdots p_r^*$ and
$\sqrt{p_1^*}\cdots\sqrt{p_r^*}$ is a square root of $-n$. Using Gauss sums, $\sqrt{p_i^*} \in \mathbf Q(\omega_{p_i}) \subset \mathbf Q(\omega_m)$.
so $\sqrt{-n} \in \mathbf Q(\omega_m)$. Since $i \in \mathbf Q(\omega_m)$, we also get $\sqrt{n} \in \mathbf Q(\omega_m)$.
Remark. When $n$ is squarefree, the least $m$ such that $\mathbf Q(\sqrt{n}) \subset \mathbf Q(\omega_m)$ is $|{\rm disc}(\mathbf Q(\sqrt{n})|$, which is $|n|$ when $n \equiv 1 \bmod 4$ and is $4|n|$ when $n \not\equiv 1 \bmod 4$.