Nostr: What is the difference between legacy DMs and NIP-17 messages?

Older Nostr direct messages commonly used the legacy NIP-04 approach.

Short answer

Older Nostr direct messages commonly used the legacy NIP-04 approach. NIP-17 specifies a newer encrypted chat design built on NIP-44 and gift wrapping, aiming to reduce exposed message metadata. A client may support one scheme, both, or neither, so apparent compatibility matters. Do not assume every message with a lock icon has the same privacy properties.

Sources

NIP-17: Private messages, NIP-44: Encryption.