There are many subtleties here. First, the law of conservation of energy, properly stated, says that the total amount of energy at one time is the same as the total amount of energy at any other time.
A problem arises if time itself has a beginning (which it does in general relativity--more about this later). In that case, the law only applies *after* the beginning of time. But the beginning of the universe and the beginning of time are the same, so you can't say anything about the energy of the universe at its beginning.
Another subtlety: in general relativity, the energy of a particle is one component o the energy-momentum vector. But, because of spacetime curvature (i.e, gravity), it turns out that computing the 'total energy' is an ambiguous operation. In essence, you need to translate the energy-momentum vector to one point to add things up, but the curvature *ensures* that the answer will depend on the path used to do the translation.
The only way to avoid this issue is to take into account curvature as one part of the total energy. But if you do that, then the total energy is always zero. In essence, the energy of curvature (i.e, gravity) is negative and cancels that of matter. That means there is no issue from energy conservation for the formation of the universe.
Now, when we add in quantum mechanics to this mix, a number of things happen. The most important is that very fast violations of energy conservation *are* allowed. The effect has even been measured. In the context of cosmology, there are two big changes: the first is that singularities tend to be 'smoothed out', allowing time to be infinite into the past, and the second is that those small, allowed violations can expand and form situations like our early universe. Again, no overall violation of energy conservation is produced.