Memories serve a very important function in our lives. To examine the importance of memories though, one must understand their functions in different capacities.
First, memories are important in regards to the way that they define who we are. We, as cognitive human beings, tend to use the memories of past events to define who we are today. Therefore, they (memories) act as a key element in our personal identity.
For example, if one was abused early in life, the memories of the abuse may cause that person to be wary of others (especially those who are mirrors of the abuser).
In psychology, PTSD (Post-Traumatic Stress Disorder) manifests from memories where the person faced and went through severe trauma. The person suffering from PTSD is unable to keep their memories of traumatic events from ruling their present life.
On a happier note, our memories provide us with recollections of the good times in our lives. The function of memories in this aspect can bring a person out of depression, allow a person to remember fondly why they love the person that they do, and/or allow a person to keep the memory of a loved one present in their lives even after the death of the loved one.
Memories which are random often submerge based upon a trigger to the senses. For example, imagine walking into a house and smelling a particular scent that immediately brings "Grandma" to mind. The recollection of the scent triggers one to flashback to where they recognize the scent from--"Grandma's" house. The instant recollection of "Grandma's" house then triggers other memories related to "Grandma."
Overall, memories are a part of our everyday lives. While we may not be thinking at the moment of an action that it will be locked away inside our brains, once we do something it simply becomes a part of our history, a memory.