I read that a corollary of the Hahn-Banach theorem is that if $M$ is a closed linear subspace of $X$ and $x \not \in M$, there is a functional $\phi \in X^*$ with $||\phi||=1$, s.t. $$ \phi M = 0, \phi x \neq 0. $$
In particular, we can form the linear subspace;
$$ Y := [x] + M = \{\lambda x + a : \lambda \in \mathbb{R}, a \in M\}, $$
where $[x]$ denotes the span of $x$.
The desired functional $\phi$ is then:
$$ \phi(\lambda x + a) : = \lambda ||x + M || $$
I don't understand...what does $||x + M||$ mean ? since $x$ is a vector while $M$ is a subspace...also how does $ \lambda ||z + M ||=0$ if $z \in M$?
$x + M$ is a coset, belonging to the quotient vector spacce $X/M$. This is well defined as long as $M$ is a closed linear subspace of $X$. This is usually given the norm $$ \|w + M\|_{X/M} := \inf_{m\in M} \|w+m\|_X$$ As part of checking that this is a norm, you'd see that $\|w+M\|=0$ iff $w\in M$. Since $x\notin M$, $\|x+M\|>0$.