Here is a simpler example in which "closed and bounded" does not imply "compact. Let A be an infinite set and define d(x,y)= 1 if [itex]x\ne y[/itex], d(x, x)= 0. That is a metric and, since the distance between any two distinct points is never less than 1, the neighborhood of point x, with radius 1/2 (or any number less than 1) is just the singleton set {x} itself.
That means that every singleton set {x} is open and, since any set can be written as a union of its singleton subsets, every set is open. Since a set is closed if an only if it is the complement of an open set, and every set is the complement of some set, it follows that every set is closed. That is, every set is both closed and bounded. This is the "discrete topology" on A.
Since the distance between two points is never larger than one, every set is bounded. In this metric, every set is both closed and bounded.
But it is easy to see that infinite sets are not compact. Given an infinite set, X, the collection of all singleton sub-sets is an open cover. Since every point in the set X is in one and only one of the subsets, we cannot remove any of them and so cannot have a finite subcover.
But the really important example of a space in which there exist closed and bounded sets that are not compact is the Rational numbers, with the metric topology defined by d(x,y)= |x- y|.
Let [itex]A= \{x \in Q| x\ge 0, x^2\le 2[/itex]. That is a closed and bounded set of rational numbers. Let [itex]\{x_n\}[/itex] be a sequence of rational numbers converging to the irrational number [itex]\sqrt{2}[/itex]. Then the collection of open sets [itex]\{0< x< x_n, x\in Q\} is an open cover for A which has no finite subcover.[/itex]