The origin of dreams: the brain is partially awaken from sleep, however our body is still sleeping.
So the thoughts of the partially awaken brain and imagery are called dream.
The brain is stimulated with the recent events and memories that were retrieved in the day before going to sleep in the night, if this is the case.
Certain areas and regions of the brain are still excited.
The brain retrieves the stored information in these areas and try to process them but can not put them together coherently.
The coherent processing and filtering out are not working intelligently so fantasies can occur. An example you may dream you are flying. If the brain was fully awake you will dismiss this thought that you are flying.
This theory is smack opposite to Sigmund Freud idea of hidden desire.
At Sigmund Freud time the brain functions were not understood as it now.
There is no hidden desire
but the area of the brain was stimulated the day before including some desires.
which is vague. At Sigmund Freud time the brain functions were not understood as now.
The story of Pharaoh at the time of Moses suggest that the day before the Pharaoh had his dream he was watching Cows or buffalos and fields of wheat.