A random variable $X$ is a mapping from $W$ to $\mathbb{R}$, that is for $\omega \in W$, $X(\omega) \in \mathbb{R}$.
$Y(\omega) = X(\omega)^2$, thus $Y$ is also a mapping from $Y: W \mapsto \mathbb{R}$.
The measure for random variable $X$ is defined by cumulative distribution function, i.e. $F(x) = \mathbb{P}(X \le x)$.
Consider, for $y>0$, $F_Y(y) = \mathbb{P}(Y \le y) = \mathbb{P}(X^2 \le y) = \mathbb{P}( -\sqrt{y} \le X \le \sqrt{y}) = F_X(\sqrt{y}) - F_X(-\sqrt{y}) + \mathbb{P}(X = \sqrt{y})$.
Thus $Y(\omega)$ is also measurable and is a random variable defined on the sample space $W$.