A space in which all compact sets are closed is known as a $KC$ space; $T_B$ space is another term that has been used.
A standard example of a compact $KC$ space that is not Hausdorff is the one-point compactification $Q^*$ of the space of rational numbers with the usual Euclidean topology. $\Bbb Q$ is not locally compact, so $\Bbb Q^*$ is not Hausdorff. Let $p$ be the point at infinity in $\Bbb Q^*$, and suppose that $K\subseteq\Bbb Q^*$ is compact. If $p\notin K$, then $K$ is a compact subset of $\Bbb Q$ with the usual topology, so $K$ is closed and compact in $\Bbb Q$, $\Bbb Q^*\setminus K$ is open in $\Bbb Q^*$, and $K$ is therefore closed in $\Bbb Q^*$.
Suppose, then, that $p\in K$. If $K$ is not closed, there is some $x\in(\operatorname{cl}_{\Bbb Q^*}K)\setminus K$. Clearly $x\in\Bbb Q$, and $\Bbb Q$ is open in $\Bbb Q^*$, so $x\in\big(\operatorname{cl}_{\Bbb Q}(K\cap\Bbb Q)\big)\setminus K$, and $K\setminus\{p\}$ is therefore not closed in $\Bbb Q$. There is therefore a sequence $\langle x_n:n\in\Bbb N\rangle$ of distinct points of $K\setminus\{p\}$ converging in $\Bbb Q$ to some $x\in\Bbb Q\setminus K$. Let $C=\{x\}\cup\{x_n:n\in\Bbb N\}$; then $C$ is a closed, compact subset of $\Bbb Q$, so $\Bbb Q^*\setminus C$ is an open nbhd of $p$ in $\Bbb Q^*$. Let $D=\{x_n:n\in\Bbb N\}$; $D$ is a discrete set in $\Bbb Q$, so we can find open sets $U_n$ in $\Bbb Q$ such that $U_n\cap D=\{x_n\}$ for each $n\in\Bbb N$. The sets $U_n$ are also open in $\Bbb Q^*$, so $\{U_n:n\in\Bbb N\}\cup\{\Bbb Q^*\setminus C\}$ is an open cover of $K$ with no finite subcover, contradicting the hypothesis that $K$ is compact. Thus, $K$ must be closed, and $\Bbb Q^*$ is $KC$.