Sketch: the cases when $A$ or $X$ is empty are easy, so we may assume $A$ and $X$ are non-empty. Since $A$ is an open and closed subset of $M - X$, $(M - X) - A$ is an open subset of $M - X$, and so there are open sets $P$ and $Q$ of $M$ such that:
$$
\begin{align}
A &=P - X \tag{i}\\
(M - X) - A &= Q - X \tag{ii}
\end{align}
$$
To show that $A \cup X$ is connected, we must show that for any open subsets $U$ and $V$ of $M$ such that
$$
\begin{align}
A \cup X &\subseteq U \cup V \tag{iii}\\
(U \cap V) \cap (A \cup X) &= \emptyset, \tag{iv}
\end{align}
$$
either $A \cup X \subseteq U$ or $A \cup X \subseteq V$.
So let $U$ and $V$ be open subsets of $M$ satisfying (iii) and (iv).
Then because $X$ is connected, either $X \subseteq U$ or $X \subseteq V$. Interchanging $U$ and $V$ if necessary, we can assume that $X \subseteq U$ (and hence that $X \cap V = \emptyset$). I claim that $A \subseteq U$ so that $A \cup X \subseteq U$ and we are done. To see this, define:
$$
\begin{align}
U' &= Q \cup U \\
V' &= P \cap V.
\end{align}
$$
Clearly $U'$ and $V'$ are open subsets of $M$. Using (i), (ii), (iii) and (iv), one shows that $M = U' \cup V'$ and $U' \cap V' = \emptyset$. Since $M$ is connected this implies that one of $U'$ or $V'$ is empty, and it can only be $V'$ since $\emptyset \neq X \subseteq U'$. But $A \subseteq P$, so $A\cap V\subseteq P\cap V = V' =\emptyset$, so as $A \subseteq U \cup V$, we must have $A \subseteq U$.