The commentators discuss the essence of choshech, darkness: Was it nothing more than an absence of light; or was choshech a creation in the same sense as light? G-d created darkness. If we view darkness as the absence of light, we can understand why darkness preceded light. There was no light – hence, it was dark. According to the Gaon, zl, m’Vilna, who contends that darkness is a creation (I have no idea how to describe the void that “existed” prior to the creation of darkness), why did it precede light? They were both equal entities. Indeed, creating light first was more “creation oriented.”
We may suggest that although Hashem created darkness, it is man who causes it to descend into his life. Each and every person travels through moments of darkness. Life is not a rose garden. How much we allow the darkness to permeate our lives, how much of the hovering darkness we allow to suffuse our daily endeavor, is up to us. Sadly, some people allow a greater amount of darkness to seep into their lives. We are all susceptible to the challenges of darkness, but some people are better than others at dealing with it. Some are so weighed down by the darkness that they do not allow for the light to creep in. Others seem to be at ease with the darkness. They have difficulty when the light is shining and life is positive. They would rather mope and blame the world for their misery than do something about it. One has to work to bring in the light. Otherwise, he remains enveloped with darkness.
This is perhaps why the creation of darkness preceded light. Hashem wants us to know that light is not to be taken for granted. One must appreciate its value and endeavor to deserve it. Otherwise, darkness will be his overriding companion.
Alternatively, I saw Horav Yosef Sorotzkin, Shlita, approach this pragmatically. Darkness is a part of life. We all have moments of darkness. For some, these moments become overwhelming. These moments can cause a person to be meyaeish, become hopeless, give up on life. Thus, Hashem created light immediately after darkness to teach us that darkness gives way to light. It may be dark now, but, ultimately, the sun is going to rise; a new dawn will begin. The very knowledge that darkness is followed by light engenders within a person a sense of hope that things will change: life will be better; a new day is dawning.