Expansion kept the early universe from becoming a black hole
The early universe was extremely dense, but it was also expanding very quickly. That expansion kept gravity from making the whole universe collapse into a black hole despite its enormous density.