The most simple set should be $M = \emptyset$, which is both open and compact, so it is clear that your two statements hold.
But let me give you another simple but somewhat less trivial example: $M = [0,1)$, which is neither compact nor open. Then you get
$$\mu(M)
= \inf\{\mu(O) : M \subset O, O \text{ open}\} \\
\le \inf\left\{\mu\left(\left(-\frac{1}{k},1\right)\right) : k \in \mathbb{N}\right\}
= \inf\left\{1+\frac{1}{k} : k \in \mathbb{N}\right\}
= 1$$
and
$$
\mu(M)
= \sup\{\mu(C) : M \supset C, C \text{ compact}\} \\
\ge \sup\left\{\mu\left(\left[0,1-\frac{1}{k}\right]\right) : k \in \mathbb{N}\right\}
= \sup\left\{1-\frac{1}{k} : k \in \mathbb{N}\right\}
= 1.
$$
Combined:
$$ 1 \le \mu(M) \le 1 \Rightarrow \mu(M) = 1.$$
The trick is just instead of calculating the infimum and supremum of all maps in question, one can get and upper and lower bound by calculating the infimum and supremum only for a sequence of sets, whose "limit" is $M$ (note that "limit" should be seen as a colloquial word here as it is unnecessary for our purpose to create a metric space of sets or sth. similar for a formal definition of "limit" first). If the upper and lower bounds are the same, one has successfully calculated $\mu(M)$.
PS: I am sure there exist more complicated and interesting examples, but you directly asked for a very simple one.