Both annotations and XML descriptors are used to describe some metadata on top of regular code. The primary difference is that in case of annotations you only have to deal with one file which includes code and metadata. It is also a big advantage of annotations as it reduces number of moving parts and increases productivity.
On the other hand, the drawback of annotations is that they bind together the code and the system or framework that operates using those annotations. That makes it harder to separate those in future.
For example, if you use Hibernate Annotations, you bind your model objects with Hibernate. If you choose to switch to different framework, you will have to rip out Hibernate annotations from the code.
But practically, it's not that likely that you will be changing frameworks that often. There are usually many other reasons why changing framework on existing code base may be hard. So often annotations is a good choice.
As to how they work, annotations are a part of the language and are processed by compiler and other tools and, depending on retention, can be included in produced bytecode for use at runtime. Ultimately, it's up to consumer to decide on how to use annotations.