Proof (compact subset in Hausdorff space is closed)
Let $x\in X\setminus Y$.
For each $y\in Y,$ since $y\neq x$, by the Hausdorff property, there exist sets $U_y, V_y$ open in $X$ such that $x\in U_y$, $y\in V_y$ and $U_y \cap V_y = \emptyset$.
By the subspace topology, $V_y \cap Y$ is open in $Y$, so $\sb{V_y \cap Y}{y\in Y}$ is an open cover of $Y$. By compactness, there exists a finite subcover $\sb{V_y\cap Y}{y\in Z}$ where $Z\subseteq Y$ is a finite subset.
Then $U = \bigcap_{y\in Z} U_y$ is a finite intersection of open sets and is therefore an open neighbourhood of $x$ in $X$. Also $$ \begin{align*} U\cap Y = \left(\bigcap_{y\in Z} U_y\right) \cap \left(\bigcup_{y\in Z} (V_y \cap Y)\right) \subseteq Y \cap \bigcup_{y\in Z} (U_y \cap V_y) = Y \cap \emptyset = \emptyset. \end{align*} $$ Therefore $X\setminus Y$ is open.