It didn’t come from nothing. The theory is that matter was all compressed at small point in the beginning, and had a rapid expulsion outward from itself, creating the universe as we know it. The Big Bang wasn’t a literal explosion that came from nothing. It’s the reason why galaxies and celestial bodies have continuously drifted away from each other.