To understand this, it helps to look at a dimension less.
Imagine, you're having a dispute with a flat-earther about whether the earth is a sphere or a flat plane. Moreover, there's a third person who holds the position that the earth is actually shaped like a saddle.
As an additional problem, in that hypothetical world, you can't see the sky, and moreover light for some reason follows the curvature of Earth (of course the flat-earther will tell you that this is because the earth is flat in the first place, and maybe in that hypothetical world it is — after all, that world doesn't follow the same physical laws as the one we live in (but we assume that geometry works the same). Also, you lack the resources to actually go around the earth, and you cannot see far enough to see the antipodes.
Now, how do you resolve that dispute? Well, there's a simple way: You select three points that are sufficiently far apart (if they are too close, you'll either not notice the curvature, or you get errors from local curvatures like hills, or both). Then you go to each of the points, and look at the angle between the directions in which you see the other two points. In other words, you add up the inner angles of a triangle.
Now on a plane, as is well known, the angles always add up to 180 degrees. But on a sphere, the angles add up to more than 180 degrees (you can see that quite nicely by looking at a triangle where one corner is at the pole, and the other two are on the equator. The two angles at the equator are both 90 degrees, and the angle at the pole is larger than zero, therefore the sum is larger than 180 degrees). Now the amount of how much larger the sum of the angles is obviously depends on the size of the triangle (as the equator-pole triangles readily demonstrate), but you'll always get more than 180 degrees. Similarly, if you do the same thing on a saddle-shaped surface, you'll always get a sum of less than 180 degrees.
Now a shape where the angle sum is larger than 180 degrees (such as a sphere) is said to have positive curvature, a shape where the angle sum has exactly 180 degrees is said to have zero curvature, and a shape where the angle sum has less than 180 degrees has negative curvature. A surface of zero curvature is said to be flat.
Note however that being flat does not completely determine the surface; for example, according to that definition, the surface of a cylinder is also flat, although it is clearly curved in space (therefore this type of curvature is also called intrinsic curvature).
Now back to space. Obviously, you can also determine the angles of triangles in space, and therefore you can also determine the curvature of space (well, strictly speaking curvature of space is a bit more complicated, but since in cosmology we assume there is no preferred direction, in the end it can again be reduced to that).
Now Einstein's Theory of General Relativity actually tells us that indeed all three cases are possible; we could live in a space of zero curvate, positive curvature or negative curvature. Indeed, locally we definitely have non-zero curvature (this is equivalent to local land forms, whose curvature can deviate drastically from the general curvature of Earth).
The question is now whether, when looking at the large scale, we have non-zero curvature. And indeed, one can measure the large-scale curvature of space using the cosmic microwave background (unfortunately I don't understand how). And the result is that space is, at least to the precision of our measurements, flat; that is, for sufficiently large triangles the sum of their inner angles always is 180 degrees, not more, not less.
This is what is meant when it is said that the universe is flat.
Note that just like in the 2D case, this doesn't necessarily mean that the universe is infinite; a flat universe could also “wrap into itself“ just as the cylinder surface does, and indeed it may do so in all directions. However we also haven't found any sign of such wrapping.
Also note that it also could still be that the universe is actually curved, but the curvature is so small that you can't measure it.