Since $X$ is a random variable, for every interval $I \subseteq \mathbb{R}$ we know that $\{X \in I\}$ is
in the event space $\mathcal{F}$. The interval $I$ can be infinite in size and
can be open or closed at either end, such as $I = (-\infty, b)$, $I=(-\infty, b]$,
$I = \mathbb{R}$, $I = (a,b)$, or $I = [a,b]$. It follows that if $\{I_i\}_{i=1}^{\infty}$ is a countably infinite set of intervals, then $\cup_{i=1}^{\infty} \{X \in I_i\} \in \mathcal{F}$. So:
-For nondecreasing or nonincreasing functions $g$: You can draw a picture to convince yourself that
the set $\{g(X)\leq y\}$ is the same as saying that $X$ lies in an interval, and hence describes an event in $\mathcal{F}$.
-For continuous functions $g$: It suffices to prove that sets of the form $\{g(X)>y\}$ are in the event space $\mathcal{F}$. Note that for any $y \in \mathbb{R}$, the set $\{x \in \mathbb{R} : g(x)> y\}$ is open. You can use the fact that any open subset of $\mathbb{R}$ is a finite or countably infinite union of disjoint open intervals: Any open subset of $\Bbb R$ is a at most countable union of disjoint open intervals. [Collecting Proofs]
Some related exercises for you to do: By the sigma-algebra definition of the event space $\mathcal{F}$ we know: (i) A finite or countable union of events in $\mathcal{F}$ is also in $\mathcal{F}$; (ii) The complement of an event in $\mathcal{F}$ is also in $\mathcal{F}$. By the definition of random variable we also know $\{X \leq x\} \in \mathcal{F}$ for all $x \in \mathbb{R}$. Show that:
a) $\{X > x\} \in \mathcal{F}$ for all $x \in \mathbb{R}$.
b) $\{X < x\} \in \mathcal{F}$ for all $x \in \mathbb{R}$.
c) The intersection of two events in $\mathcal{F}$ is also in $\mathcal{F}$.
d) $\{X \in (a,b)\} \in \mathcal{F}$ for all $x \in \mathbb{R}$.
e) Complete the details to show that if $g$ is continuous then $g(X)$ is a random variable.