But I've heard it said that in quantum mechanics the universe could have been created out of nothing, and wouldn't need an outside cause like God.
For example, when I say I had nothing for breakfast, it literally means that I did not have anything at all for breakfast.
But a problem arises because when scientists talk about the universe coming out of nothing, they are using the word “nothing” in a different way. Scientists like Sean Carroll and Lawrence Krauss speak of this "nothing" as something unstable, having energy, having a certain behavior, and even weighing something.
And so actually, when physicists refer to “nothing,” in this sense, they at times are using the word to refer to, well, something. Things like quantum vacuum fluctuations or quantum fields, or a singularity of infinite mass. So even if this origin theory of the universe is true, the quantum nothing is not really nothing, so it doesn't avoid the problem of its existence needing an explanation. If you want to find out more about the science of the beginning of the universe, I want to encourage you to check out another topic called the Kalam Cosmological argument.