We do not know. There are many aspects to this problem that are probably unknowable. Some cosmologists and physicists, including many prominent Nobel lauriats, subscribe to some version of the so-called Anthropic Principle. This states that we as observers of the universe are not independent of the thing we are observing. A simple calculation shows that had many of the natural constants had values only a few percent different than the ones we observe, our kind of life would have been impossible. For instance, had the electromagnetic force been slightly stronger, you could never get organic chemistry to work on the surfaces of planets because the chemical bonds would be too strong to allow complex chemical reactions to take place. If the force of gravity were too strong, the universe would never have lived long enough to enter a cool phase conducive to life...and on and on it goes. This can even be extended to various laws such as the law of gravity which says that the force varies as the product of the masses divide by the square of the distance. If it had varied by distance to the 1.8 power or 2.04 power, our solar system would not look the same nor would the planets orbit in stable, elliptical paths for billions of years.
Of course, you cannot use the Anthropic Principle to do much more than marvel at how intimate is the bond between the physics we measure and our own existence. You cannot use it to PREDICT anything interesting, which is an essential requirement of any theory. All you can use the Anthropic Principle for is to set the parameters, the so-called boundary conditions, upon the theories you devise to account for what you observe. All theories are expressed in terms of what are called 'differential equations'. These equations have adjustable parameters that have to be provided by experiment and observation to give solutions appropriate to the world we live in. We do not know how these fundamental constants are 'set', but after the Big Bang happened, their values were already defined for our universe within the first trillion, trillion, trillionth of a second.
Some physicists believe that in the quantum state out of which our universe emerged to begin the current expansion, there may have existed an infinitude of possibilities for these constants, and in some unknowable sense, all of these possibilities are actualized. We 'just' happen to live in a universe where the constants and the laws themselves were supportive of life. In the great span of infinity, there may be incomprehensible numbers of 'failed' universe whose quantum seeds did not germinate the right way to create 'self-consistent' physical systems.
Will we ever understand what went on then? Probably not, but one thing we do know given the successes of Big Bang cosmology, is that the universe we see was once skrunched into a size smaller than an atom. The only physical rules that could operate then were Quantum Mechanical rules, which have nothing to do with common sense. Perhaps by learning more about what quantum mechanics is all about, we can explore just how our universe developed, and why it has the laws it does.
As for Creationists, they did not invent any of this discussion, but 'borrowed' it from the cosmologists and cleverly bent it to support their own opinions about how the universe came to be. If you wish to believe the Creationists, then you must abandon virtually everything we have learned about physics, chemistry, astronomy, geology and genetics during this century. This seems a rather large price to pay just to continue to believe an idea that the vast majority of the extant world religions along with most scientists do not subscribe to.
I do not believe, personally, that all ideas are equal and should be accorded equal time. Certainly our children should not be exposed to them. Should we allow slavery to be taught in school? It is an old and venerable theory of how to deal with people who do not look like you! How about Hitler's Genetics? Obviously societies decide that certain ideas are simply intolerable. Am I over reacting by equating Creationism with these other ideas? No, I don't think so.
Creationists recognize that they work in the shadows of our educational system. Quietly they go about having their ideas brought into the classroom. Most citizens get subverted by the chant that 'all theories should be given equal time' so that impressionable children can make up their own minds about the 'facts'. It does sound perfectly reasonable doesn't it? Only a mad man, or one of those fuddy-duddy narrow-minded scientists would object to this? That's why so many school districts now require that textbooks drop evolution, or that textbook writers simply avoid any mention of evolution because they know that if they mention evolution, they will loose millions of dollars in potential sales. Now the question is not of truth, but of capitalistic greed, and this is where Creationists know they have truth over the barrel in this society.
Unfortunately we live in a very complacent society, which has become tolerant of a broad spectrum of ideas. So long as the ideas do not affect us personally, or our pocketbooks, we tend to ignore them. The problem with Creationism, and a broad melange of other pseudo-scientific ideas, is that their influences are growing, and have been doing so for the last few decades. Their incessant babble suffuses our society with an almost deafening background noise. When a recent president uses an astrologer to advise on when to schedule meetings, do you really think we are living in a society based on rationality and the respect for reason? What do you think will be the outcome of a society that gets drowned in a flood of misinformation and illogical thinking? Do you honestly think that such a society could reason its way to avert another Holocaust in the face of the rhetoric by some charismatic leader?
This is serious business. Do not think for a moment that it isn't otherwise! It is not just a battle between a handful of scientists and a minority fringe in contemporary religion. There are many other things at stake as well.
I'm sorry to go on about this, but the question is a serious one, and science is doing the best it can to ferrit out some kind of perspective on it.