The reason this happens is because everything that has happened, is happening, all at once. As PTSmorrow said, time is not linear; further, reality is sequenced by our consciousness. Our awareness at any given moment can be on multiple layers of reality, subconscious, etc. When we dream we are experiencing another "version" of "reality". Quotes because dreams and reality are the same; we "live" in "reality" and dream our dreams by matter of common convention. Since every event is taking place simultaneously, things get crossed, if you will. Something you dream about is before time, before our consciousness sequences the events by logical order. In essence, time is merely this sequencing; that is why it appears to slow down and speed up, depending on the subjective experience.