Let $A$ be a ring (commutative with 1) and $M$ a maximal ideal of $A$. Let $x \in A-M $. Since $M$ is maximal, the ideal generated by $x$ and $M$ is $(1)$, i.e. the entire ring.
I don't understand how that is true. If $x$ were a unit, certainly. However, $x$ could be contained in some other maximal ideal and is not guaranteed to be a unit. So how can we be sure that $x$ and $M$ can generate $A$?
The ideal generated by $x$ and $M$ strictly contains $M$ (as $x \notin M$ by assumption). Then, since $M$ is maximal, by definition, any ideal containing $M$ must be the whole ring; thus, $(x,M)$ is the entire ring (as dezdichado said in the comments).