Why random variable is defined as a mapping from the sample space?
This was originally posted as a comment:
Here is a question whose goal is to make you understand what others already wrote. Follow your suggestion and assume that X: $\mathcal{F}\to\mathbb{R}$ for your favorite random variable X (say, the result of the throw of a die, that is, an integer from 1 to 6). What numbers would be X(∅) and X(Ω)?
To which Leo answered this:
This is a very good point, thank you. It made me realize that events from $\mathcal{F}$ may happen simultaneously; in particular, event Ω always happens with any event. If we define X on $\mathcal{F}$, how to choose its values then? For a "die" random variable, for example, there is no way to define it on $\mathcal{F}$.
The sample space can be viewed as the "states of nature." A random variable represents a measurement of the system under observation. The $\sigma$-algebra represents the subsets of the sample space to which we can assign probability.
The main reason is that in probability theory one often works with multiple $\sigma$-algebras defined on a common sample space $\Omega$.
A very standard example is a collection of $\sigma$-algebras $({\mathcal F})_{n \in {\mathbb Z}}$ such that ${\mathcal F}_n \subset {\mathcal F}_{n+1}$ for all $n \in {\mathbb Z}$. If one thinks about the $\sigma$-algebra as an amount of knowledge about $\Omega$ then this would represent gradual gathering of information. Therefore if $X$ is ${\mathcal F}_n$-measurable for some $n \in {\mathbb Z}$ it will naturally be measurable in all "later" algebras ${\mathcal F}_m$, $m \geq n$. From this point of view, it's more natural to think about $X$ as residing in $\Omega$ rather than in one concrete $\sigma$-algebra. [Note: nevertheless, it's true that there exists also a canonical $\sigma$-algebra associated with $X$, namely $\sigma(X)$ which is a smallest $\sigma$-algebra that makes $X$ measurable.]
Another reason one doesn't want to restrict random variable to one particular $\sigma$-algebra is that we often use operations such as conditional expectation $\mu(X\mid {\mathcal A})$ of random variable w.r.t. $\sigma$-algebra. Operations like these effectively change what you'd consider a domain of the random variable from one $\sigma$-algebra to another.
There is much more to be said and it all has to do with probabilistic way of thinking but the bottom line would be that in probability theory one has a huge amount of freedom of how to model the given problem: there is no canonical sample space, no canonical $\sigma$-algebra and no canonical measure; each of them can be extended and restricted as the need requires.