A file on a Mac can carry more than its content. Extended attributes hold things like where it came from, and xattr lets you read them.
xattr -l ~/Downloads/app.dmg
xattr ~/Downloads/app.dmg
Without options xattr lists the names of the attributes. With -l it also prints the values. For a download you will often see com.apple.quarantine, the flag Gatekeeper uses. It is a string with a score, the download time, the app that downloaded it and an event ID.
Knowing it is there explains why a file you got from a browser opens with a warning, while the same file copied from a USB stick does not.
You can write and delete attributes too: -w writes one and -d deletes one. Removing the quarantine flag with xattr -d com.apple.quarantine file skips the Gatekeeper check for that file.
The caveat is exactly that. I would only do it for something whose source I trust and have checked. Removing the flag is not a fix for “the app is damaged”, it is a decision to stop macOS from checking, so verify the publisher first. Also be aware that the quarantine attribute travels: Eclectic Light notes it is one of the stickiest attributes and propagates to files extracted from an archive. For the full list of options see man xattr on your own Mac.
Further reading: The Eclectic Light Company: extended attributes, Eclectic Light: from quarantine to provenance