That's a whole loop around earth.
40,000km would be either reference to the longest latitudinal distance - equatorial, so essentially saying they tracked it flying one entire loop around the earth. Or the distance covered is 40,000km which happens to be the equatorial distance. If choosing a higher latitude (where China is), the distance would be roughly 20,000km to 30,000km distance, potentially circling twice assuming the 40,000km is referring to actual observed distance flown. This is probably not the case and the 40,000km was in reference to equatorial distance and making the point that it was a round the earth flight.
China flying a hypersonic aircraft within the atmosphere (said by both US and China that this was within the atmosphere which is hyper impressive) may have required some NOTAM and/or it would have to avoid certain places even if it is too high up to count as certain airspace or passing by way too fast. There is close to 0 chance of it hitting anything commercial even if there was an issue or failure. because the chances of such a thing hitting another is easily 1 in many billion.
Still the path would have curved and steered around sensitive areas... or maybe not. Either way this flight could have been through the poles to avoid issues, passing only a few nations which are neutral, friendly, or indifferent. The average speed is approaching Mach 20.