What are the matrices $A \in \mathscr{M}_n(\mathbb C)$ for which the similarity class is closed?
What about the same question if we replace $\mathbb C$ by $\mathbb R$?
What are the matrices $A \in \mathscr{M}_n(\mathbb C)$ for which the similarity class is closed?
What about the same question if we replace $\mathbb C$ by $\mathbb R$?
The similarity orbit of a real or complex square matrix $A$ is closed if and only if $A$ is diagonalisable over $\mathbb C$.
G. Sassatelli has already explained the "only if" part in their comment. When the ground field is real, the analogous trick applies if you consider the real Jordan form instead of the usual Jordan form.
To prove the "if" part, note that the complex eigenvalues of a matrix vary continuously with the matrix entries (e.g. see this previous question or this answer). So, if $B$ is a limit point on the similarity orbit of $A$, it must have the same complex eigenvalues (counting multiplicities) as $A$. Denote those distinct complex eigenvalues of $A$ by $\lambda_1,\ldots,\lambda_k$ ($k$ may be smaller than $n$ because there may be repeated eigenvalues). Then $p(x)=\prod_{j=1}^k(x-\lambda_j)$ is the minimal polynomial of $A$. As $p$ is continuous, it also annilihilates $B$. Therefore $p$ is the minimal polynomial of $B$ and $B$ is diagonalisable over $\mathbb C$ too. In short, $B$ is a diagonalisable matrix with the same spectrum as $A$. Hence $A$ and $B$ are similar over $\mathbb C$. Since matrices over a field $F$ are similar if they are similar over an extension field, in case the ground field is $\mathbb R$, $A,B$ are similar over $\mathbb R$ too.
$\newcommand{\cj}{\operatorname{cj}} \newcommand{\diag}{\operatorname{diag}}\newcommand{\nil}{\operatorname{nil}}\newcommand{\Spec}[1]{\operatorname{Spec}\left({#1}\right)}$
Complex case:
Let us prove/recall a lemma:
Lemma 1: The function $\dim\ker:\mathscr M_n(\mathbb C)\to \mathbb N$ is upper-semicontinuous, i.e. $$\lim_{s\to\infty}M_s= M\implies\dim\ker(M)\ge \limsup_{s\to\infty}\,\dim\ker M_s$$
Indeed, let $q=\limsup_{s\to\infty}\dim\ker M_s$. This means that there exists a sub-sequence $M_{s_h}=M'_h$ such that $\dim\ker M'_h=q$.
Let us consider the standard hermitian product on $\mathbb C^n$ and let us pick $(v_1^h,\cdots,v_q^h)$ an orthonormal basis of $\ker M'_h$.
Recall that $S^{2n-1}=\{v\in \mathbb C^n\, :\, \Vert v\Vert =1\}$. The sequence $$\{(v_1^h,\cdots,v_q^h)\}_{h\in\mathbb N}\subseteq \underbrace{S^{2n-1}\times\cdots\times S^{2n-1}}\limits_{q\text{ times}}$$ has values in a compact subspace of $\mathbb C^{qn}$, therefore it admits a converging subsequence.
So, we have a subsequence $(v^{h_r}_1,\cdots,v^{h_r}_q)\to_r (w_1,\cdots, w_q)$. By continuity of the hermitian product, the latter is a family of orthonormal vectors, hence independent.
Let's call $M^{\prime\prime}_r=M_{h_r}'$
Now, \begin{align}\Vert Mw_j\Vert=\Vert Mw_j-M_r''v^{h_r}_j\Vert&\le \Vert (M-M_r'')w_j\Vert +\Vert M_r''(w_j-v_j^{h_r})\Vert\le\\&\le \Vert M-M_r''\Vert\cdot\Vert w_j\Vert +\left(\sup_r\Vert M_r''\Vert\right)\cdot\Vert w_j-v^{h_r}_j\Vert\stackrel{r\to\infty}{\longrightarrow} 0\end{align}
So $Mw_1=Mw_2=\cdots=Mw_q=0$, hence $\dim\ker M\ge q$. $\square$
Back to our problem: The answer is: $\cj A$ is closed if and only if $A$ is diagonalizable.
If part: $A\text{ diagonalizable}\implies \cj A=\overline{\cj A}$
Indeed, let $\Spec{A}=\{\lambda_1,\cdots,\lambda_k\},\ k\le n$ its dinstinct eigenvalues. Let $\dim\ker(A-\lambda_sI)=m_s$.
Since $A$ is diagonalizable, it holds $$M\in\cj A\iff \forall s=1,\cdots, k,\ \dim\ker(M-\lambda_sI)=m_s$$ Let $\{A_h\}_{h\in \mathbb N}\subseteq \cj A$ a converging sequence $$A_h\to B$$
Then, for all $s$, $A_h-\lambda_sI\to_h B-\lambda_sI$.
By lemma 1, $\dim\ker (B-\lambda_sI)\ge m_s$. But $$n=\sum_{s=1}^k m_s\le\sum_{s=1}^k\dim\ker(B-\lambda_sI)\le n$$ so the only possible choice is $\forall s,\ \dim\ker (B-\lambda_sI)=m_s$. Hence, $B\in\cj A$.
Only if part: $ \cj A=\overline{\cj A}\implies A\text{ diagonalizable}$
The diagonalizable+nilpotent decomposition $A=\diag A+\nil A$ yelds that for all $\varepsilon>0,\ \diag A+\varepsilon\cdot \nil A\in \cj A$. But then $\diag A\in\overline{\cj A}=\cj A$. So $A$ is diagonalizable. $\square$
Real case:
The fact that $\mathscr{M}_n(\mathbb R)$ is embedded in $\mathscr M_n(\mathbb C)$ and that, for all $A\in\mathscr{M}_n(\mathbb R),\ \cj_{\mathbb R}(A)=\cj_{\mathbb C}(A)\cap \mathscr{M}_n(\mathbb R)$ yields that a real matrix which can be diagonalized in $\mathbb C$ has closed real similarity class. The same trick used for the converse in the complex case can be adapted to fit the real case, considering the real Jordan form, as user1551 recalled.