An annotation is a block of metadata written in a comment above a class. Drupal uses annotations to declare plugin information, routes, and other extension points.
For example, a custom block plugin has a Block annotation above its class defining the plugin’s ID, administrative label, and category. Drupal reads the annotation when discovering plugins and uses the metadata to populate admin interfaces and route definitions.
Annotations come from the Doctrine library and look like structured comments. They are not executed like code but parsed and interpreted by Drupal. Newer PHP versions support attributes as a native alternative to annotations, and Drupal is gradually adopting them. For now, most plugin declarations still use annotation style, but you may see attributes more often in Drupal 12 and beyond as the ecosystem catches up.