Let $A\subseteq K\subseteq\mathbb{R}$ where $K$ is compact.
Since $K$ is compact, then let $\bigcup_{i\in I} U_{i}$ be a cover of $K$ by open subsets of $\mathbb{R}$
$\implies\exists\space r\in\mathbb{N}$ such that $U_{1}\bigcup U_{2}\bigcup$...$\bigcup U_{r}=C$ covers $K$ as well.
But $A\subseteq K$, so $C$ covers $A$ as well. Since the initial cover was chosen arbitrarily, then by definition, $A$ must also be compact.
I know there is something wrong in my reasoning because, in $\mathbb{R}$, I can pick the set $(0,1)\subseteq[-1,2]$ with $(0,1)$ not compact since it is not closed and $[-1,2]$ compact since it is closed and bounded. Can anyone tell me where I'm erring?
Not every open covering of $A$ is an open covering of $K$. In your specific example, for instance, the sets $U_{n}:=(\frac{1}{n},1-\frac{1}{n})$ form an open covering of $(0,1)$ but not of $[-1,2]$.
Your reasoning was incorrect because, you only showed that every open cover of $K$ has a finite subcover which covers $A$.