The reference to $\text{A}003649$ in the comments to $\text{A}003172$ clarifies the matter in the same way the comments do: we are talking about the ring of integers $\mathcal O(\mathbb Q(\sqrt n))$ of $\mathbb Q(\sqrt n)$ and not the field extension itself. Of course, you are right that $\mathbb Q[\sqrt n]=\mathbb Q(\sqrt n)$ is always a field, so in particular a UFD.
The referenced sequence lists the class numbers of real quadratic fields, i.e. $\mathbb Q(\sqrt n)$ with $n>0$ (and $n$ squarefree to really get different fields for different values of $n$). The class number is an arithmetical quantity attached to a field, or more precisely to its ring of integers, which measures the failure of unique factorization. It is equal to $1$ if and only if the ring of integers is a UFD. In the case of quadratic fields one can show that
$$
\mathcal O(\mathbb Q(\sqrt n))=\begin{cases}\mathbb Z\left[\frac{1+\sqrt n}2\right]&,n\equiv1\mod 4\\\mathbb Z[\sqrt n]&,n\not\equiv1\mod4\end{cases}
$$
and these are the rings which are UFDs exactly for the $n$ listed on $\text{A}003649$, i.e. the $n$ for which the class numbers is $1$ as listed on $\text{A}003172$.
The title question is answered by Rene Schipperus. In general, a good way of investigating if a ring is a UFD is to find different factorizations and show that all factors are irreducible but not associated. For such quadratic rings $\mathbb Z[\sqrt n]$ a good tool for is the norm function:
$$
\mathrm N\colon\mathbb Z[\sqrt n]\to\mathbb Z,a+b\sqrt n\mapsto a^2-nb^2
$$
For example, an element is a unit iff its norm is $\{\pm1\}$ and if its norm is a prime, it is irreducible. You can find more about this in the answers to this question.