The definition of a metric space guarantees that if we pick three points from it, we can draw a triangle in the Euclidean plane, with vertices labeled
so that the side lengths are equal to the corresponding distances
in the metric space. In other words, we can represent any triple of points as vertices of a triangle.

The above paragraph is from Tight spans and Gromov hyperbolicity, but here the similarity ends. Moving on to four points we find that it is possible to draw a quadrilateral with side lengths equal to the corresponding distances
.

Except for the degenerate case (one length equal to the sum of three others), the quadrilateral is not rigid: one can change the angles while keeping the sidelengths the same.
Since the quadrilateral has one degree of freedom, we cannot hope to have the correct lengths of both diagonals and
. One of two diagonals can be made to match the metric space distance, just be drawing two triangles and gluing them together. But this is not so interesting.
There is an interesting class of metric spaces for which one can always draw a Euclidean quadrilateral as above so that neither diagonal is too short (they are allowed to be too long). These are called CAT(0) spaces, and they generalize the concept of a Riemannian manifold of nonpositive sectional curvature (more on this later). Every Euclidean space is CAT(0) for obvious reasons.
For example, if a CAT(0) space contains four points with pairwise distances ,
, then
. Indeed, any Euclidean quadrilateral with these sidelengths is a parallelogram, in which the sum of squares of the diagonals is
. (It never pays to draw
with self-intersections, because that only makes the “diagonals” shorter).
For a non-parallelogram example, take ,
,
,and
. The diagonal lengths
and
are allowed by the axioms of a metric space, but not by the CAT(0) condition.

This can be checked using a bunch of cosine formulas:
where the last computation is simpler because is isosceles. Since
, the addition law of cosines yields a contradiction.
Let’s see what CAT(0) has to do with curvature. First, a closed curve with intrinsic metric is not a CAT(0) space. Indeed, one can find four points on the curve that are equally spaced at distances
, where
is the length of the curve. Then the corresponding Euclidean quadrilateral must be a rhombus of sidelength
. One of its diagonals will be at most
, which is less than
required by the intrinsic metric of the curve.
As a corollary, a CAT(0) space does not have closed geodesics. One can object that compact negatively curved manifolds (e.g., double torus) have plenty of closed geodesics. The answer is that to actually characterize nonnegatively curved spaces, one must impose the CAT(0) condition only locally.
The standard definitions of a CAT(0) space require any two points to be connected by a geodesic, and are stated in terms of geodesics. Here is one of them: for any geodesic and for any fixed point
the function
is convex. (Here is the square of the distance.)

The condition (1) may look contrived, until one realizes that in a Euclidean space is always an affine function. Thus, the definition says that the distance function in a CAT(0) space is at least as convex as in a Euclidean space. By the way, (1) indeed implies that
is a convex function. I leave this as an exercise.