The preimage of an open set under a continuous function is open, but the image of an open set under a continuous function is not necessarily open.
Let's say $f: X \rightarrow Y$ is continuous and $U \subseteq Y$ is open.
Here's a proof of why $f^{-1}(U)$ must also be open.
Let $p \in f^{-1}(U).$ Then by definition of a preimage, $f(p) \in U$. Since $U$ is open in $Y$, there exists $\epsilon > 0$ such that $B_{\epsilon}(f(p)) \subseteq U$. Since $f$ is continuous at $p$, there exists $\delta > 0$ such that $q \in B_{\delta}(p) \implies f(q) \in B_{\epsilon}(f(p)).$
But since $B_{\epsilon}(f(p)) \subseteq U$, this says that anything in $B_{\delta}(p)$ is sent to something in $U$, so that all of $B_{\delta}(p)$ is contained in the preimage of $U$. Thus there exists an open ball $B_{\delta}(p) \subseteq f^{-1}(U),$ so $f^{-1}$ is open in $X$.
Think of open/closed sets as properties that map well in the "backwards" direction, i.e. open image to open preimage under a continuous function. Think of the definition of continuity: for any $\epsilon > 0$, we can go "backwards" and get a $\delta > 0$... such that a ball of radius $\delta$ around some $x$ in the preimage gets mapped to a ball of radius $\epsilon$ around $f(x)$ in the image.
You cannot replicate this in the "forwards" direction.
For example, take a constant continuous function.
$f: (0,1) \rightarrow \mathbb R$ defined by $f(x) = 1$ is continuous but maps an open set $(0,1)$ to a closed set (singletons are closed) $\{1\}$.