Not necessarily. For each $r\in\Bbb R$ let $D_r=\{0,1\}$ with the discrete topology, and let $X=\prod_{r\in\Bbb R}D_r$. $X$ is separable by the Hewitt-Marczewski-Pondiczery theorem.
For $x\in X$ let $\operatorname{supp}x=\{r\in\Bbb R:x_r=1\}$, the support of $x$. Let $D=\{x\in X:\operatorname{supp}x\text{ is finite}\}$, the set of points of $X$ with finite support. It follows easily from the definition of the product topology that $D$ is dense in $X$. However, $D$ is not separable.
To see this, suppose that $C\subseteq D$ is countable, and let $A=\bigcup_{x\in C}\operatorname{supp}x$; clearly $A$ is countable, so there is an $r\in\Bbb R\setminus A$. Define $x\in X$ by $x(r)=1$ and $x(s)=0$ for $s\in\Bbb R\setminus\{r\}$; clearly $x\in D$, and $\{y\in X:y_r=1\}$ is an open nbhd of $x$ disjoint from $C$, so $C$ is not dense in $D$. Thus, $D$ is not separable.
Note that $X$ is a pretty nice space, since it’s compact and Hausdorff.