DKIM (DomainKeys Identified Mail) is a technology that attaches a cryptographic signature to outgoing email: the sender's server signs the message with a private key, and the recipient verifies it with a public key published in a DNS TXT record.
When a message is sent, the mail server hashes the headers and body and encrypts the hash with a private key, producing a DKIM-Signature header. The receiving server reads the selector name, fetches the public key from a TXT record in the domain's DNS and checks the signature. A match proves the message was not altered in transit and really came from that domain.
DKIM solves several problems at once:
DKIM works together with SPF, which validates the sending server, and a DMARC policy; together they protect mail arriving through the domain's MX servers.