Your picture of the surface of a donut is correct: it is curved.
Not all metrics on a topological surface will have the same local properties.
For example, although a donut surface does indeed have flat metrics, it also has nonflat metrics, and the donut surface is one of them. 2d entities living on the surface of a donut could indeed distinguish their donut from pac-man's world, by making little measurements of length and area. For instance, they could measure the radius and area of a small circle on their world, and for almost any circle they chose, they would discover that the formula $A=\pi r^2$ fails, so their world is not flat.
More specifically, if they take a small circle centered at a point on the inside of the torus, $A > \pi r^2$ (the surface is negatively curved in the inside region). On the other hand, if they take a small circle centered at a point on the outside of the torus, $A < \pi r^2$ (the surface is positively curved in the outside region).