Many features and rules refer to a creature's "game statistics".
For example, True Polymorph says:
The target's game statistics, including mental ability scores, are replaced by the statistics of the new form.
and Possess Corpse, an ability of a Dybbuk, says:
It otherwise uses the target's game statistics, gaining access to its knowledge and proficiencies but not its class features, if any.
Sometimes it instead just refers to "statistics" as in the description for a character with lycanthropy in the Monster Manual:
A character who becomes a lycanthrope retains his or her statistics except as specified by lycanthrope type.
What all is included in a creature's "game statistics" or "statistics"? Where in the rules is this defined?
Note that the term is used interchangeably between things intended for PCs and things intended for monsters and other creatures so answers should cover all those possibilities.
What counts as statistics for monsters is defined in the Monster Manual introduction in the section "Statistics". It begins by saying:
We have here a general rule that is easy to apply: if it is in a stat block then it is considered part of that creature's statistics.
The book describes each aspect of the statistics in a short sub-section (MM 6-11).
Class and class features are part of statistics too (including feats)
Monsters, by default, are not given class levels and thus no section was dedicated to talking about them as part of the statistics. However, a later section talks about the option of adding class levels to monsters:
Since class levels and class features are also added to a monster's stat block, and the terms "statistics" and "stat block" are defined to be interchangeable (per the first quote in this answer), monster class levels and all the features thereof count as part of a monster's statistics.
Feats appear to be generally given by a class:
Thus, as a class feature, Feats are also considered to be part of a monster's statistics.
Legendary Creatures have Legendary Actions as part of their statistics
When a creature is a legendary creature it sometimes has special actions called Legendary Actions inserted into their stat block. These (as with everything else in the stat block) are considered part of the creature's statistics.
Note that some legendary creatures also have lair actions and regional effects. However, these appear outside the stat block and the Monster Manual makes it clear that not every legendary creature with those listed even has access to them. So these would not be considered as part of that monster's statistics.
An NPC's stats can be generated in several different ways as defined in the DMG section called "NPC Statistics":
It is clear that what counts as statistics for an NPC are the same as what counts for monsters and PCs. However, the DM, for simplicity's sake, has a lot of leeway on how many of those statistics they need to define when making an NPC. Of note is that NPC class levels and equipment are also considered part of their statistics.
The statistics for a PC include all of the same things as for monsters and NPCs. The description of building an NPC like a PC (above) confirms that creatures built this way count those things as statistics and really that just makes sense.
Basically, anything on the standard PC character sheet is considered to be a statistic.