Out of is a complex preposition and merits its own entry in the OED (Oxford English Dictionary), separate from the entry for out. It has numerous uses, but in your first two examples it means the opposite of in. In your third example, the use of to is rather different, and not really relevant to the main question.
Out of has a long history, but this extract from the OED’s etymological note may help to answer your question more fully:
The history of out of is partly parallel to that of in to, with the
differences that the latter is now written into as one word, and that
out of is the opposite, not only of into, but also of the static in.
One reason why out of has not needed to be written as one word may be
that the distinction now made between into and in to is in the case of
out expressed by out of and out from: thus ‘they came in to me, into
my house’, ‘he went out from me, out of my house’.
There has been discussion in the comments on another answer about the use of out followed immediately by a noun phrase. Out is used in this way with two main meanings. The first (1) is ‘from within, away from’, as in this 1992 citation from Toronto’s ‘Globe and Mail’:
When you become useless, you're out the door.
The OED describes this use as being formerly poetical and now regional and nonstandard.
The second main meaning (2) is ‘outside, beyond’, as in this 1977 citation from J P Donleavy:
A thrush chirping its evening song in the first darkness just out the
The OED describes this use merely ‘now nonstandard’. This 1991 citation seems to me to confirm this view:
He spent too much time boozing down the pub. Too much time out the
It may be that out + noun phrase is Standard American English in sense (1), but nonstandard, as in British English, in sense (2).
Research in 1997 into the use of out the door and out the window, reported in ‘The Cambridge Guide to English Usage’, ‘found ample evidence of their use in spoken discourse and in published fiction, though this doesn’t yet guarantee their place in British written style generally.’