The events and scenes formed in dreams come from people's existing cognition and memory, including sight, hearing, smell, taste, touch and feeling.
For example, there is something that makes you particularly excited during the day, and you are still thinking about it before going to bed. When other nerve cells in the brain are at rest and these nerve cells are still excited, you will have a dream with similar content, which is called "thinking day and night".