How can the universe be flat?
1 Answer
It's not.
Explanation:
Most astronomers believe the universe to be spherical, some say it mostly looks like a soccer ball, multiple flattened sides than perfectly round.
Astronomy, astrophysics, quantum physics are full of enigmas and paradoxes. The lack of a "unified field" shows one of the problems. The unified field theory says one set of math should work both in the world of the huge, astro, and the world of the tiny, quanta. Right now that is not the case.
Also, consider that 95% of the total mass of the universe is "missing." By that I mean, dark matter. The amount of mass necessary to create the amount of known gravity cannot be explained solely within the seeable universe. What we can see gives us 5% of the gravity.
Your question is a good one but impossible to answer with any certainty and unlikely to be answered any time in the near future.