Let $E=(E,\|\cdot \|_E)$ be a Banach space and $X \subset E$ a closed subspace of $E$. Then $X=(X,\|\cdot \|_E)$ is also a Banach space. Moreover, I know that, the dual of $E$ is cointaned in $X$, that is, $E' \subset X'$ (right?). And if $\text{dim}(X)< \infty$ then $\text{dim}(X')=\text{dim}(X)$. Here, $\text{dim}(X')$ and $\text{dim}(X)$ denote the dimension of $X$ and $X'$, respectively.
Question. If $\text{dim}(X)< \infty$ and $\text{dim}(E)=\infty$, then $\text{dim}(E')=\infty$ and $E' \subset X'$?
This seems strange to me, because in this case I would be saying that a space of finite dimension is contained in a space of finite dimension. Or am I thinking something wrong?
The fact that you can think, via restriction, of a functional in $E'$ as a functional on $X$, doesn't mean that there is an inclusion $E'\subset X'$. This can be very easily seen in examples.
For instance let $E=\mathbb C^2$, and $X=\{(a,0):\ a\in\mathbb C\}$. Then $E'=\mathbb C^2$, where you think of $(c,d)$ as the functional $\langle (c,d),(a,b)\rangle=ac+bd$, and $X'=\mathbb C$. So here $\dim E'=2$, $\dim X'=1$.
Even when both $X\subset E$ are infinite-dimensional, the inclusion $E'\subset X'$ often makes no sense. For instance let $E=\ell^2(\mathbb N)$, and $$X=\{f\in E:\ f(1)=0\}.$$ Now consider $\phi,\psi\in E'$ be given by $$ \phi(f)=f(1),\qquad \psi(f)=2f(1). $$ Both $\phi$ and $\psi$, which are distinct, are zero when restricted to $X$. In what sense do you want to see them as distinct elements in $X'$? Of course one can create an artificial inclusion (after all, in this example $E=X=E'=X'=\ell^2(\mathbb N)$), but the point is to have an inclusion that is canonical, in which functionals are considered as functionals.
For a more brutal example, let $E=\ell^\infty(\mathbb N)$ and $X=c_0$, the space of sequences that converge to zero. Then $X'=\ell^1(\mathbb N)$, which is separable, while $E'$ is not separable since $E$ isn't. So there is no possible inclusion $E'\subset X'$ as normed spaces, not even an artificial one.