Don't know much about why we dream.
I do know that lucid dreaming is possible. That is you can be somewhat aware that you are in a dream. You can even control the dream by manifesting objects you want to see or you can even fly.
In order to have lucid dreams you need two do three things consistently:
Have a dream journal.
Where you write down everything that you can recall from the last dream you had.
Ideally write in it right after you woke up and try hard to recollect as much as possible from the dream. With time your recall will greatly increase and you will be able to remember more. And even see common repeating patterns that appear throughout your dreams.
Do reality checks.
Throughout the day, ask yourself whether you are currently dreaming and do a reality check. One of the most effective checks is to block your nose and try to breathe through it. In a dream you should be able to feel air coming in and out through the nose even if it is physically blocked.
Another effective check is to try to jump very high with an intention to fly. In a dream you should be at least be able to levitate a bit if not fly all together. Do that very often throughout the day so its ingrained in your memory as a kind of habit. This way you will repeat this reality check unconsciously when you will dream.
Practice staying lucid when dreaming.
First time you will realize you are indeed in a dream, you will most likely wake up straight away because you will be excited that you are indeed lucid and in a dream.
You can prevent this by trying to focus on something inside the dream like rubbing your hands together very fast or spinning. This often makes you gain more control of the lucid dream. You will also be able to stay in a lucid dream longer by simply having more lucid dreams and more practice.
I personally write digitally all my dream recollections in Day One under
To be more consistent with my diary and to develop the habit, I have my phone prompt me on waking up to open Day One and write what I remember from my dream.
I usually just write a bunch of bullet points of distinct things I remember from the dream instead of telling the whole story.