Since macOS 10.15, software distributed outside the App Store with a Developer ID must be notarized by Apple, meaning it was uploaded, scanned, and issued a ticket. On first launch of a quarantined app, Gatekeeper checks the signature and the notarization ticket and refuses to open anything that fails.
Diagnose from the command line rather than from the dialog. 'spctl --assess --type execute --verbose=4 /Applications/Example.app' prints accepted or rejected plus the source of the verdict. 'codesign --verify --deep --strict --verbose=2' reports signature problems, and 'codesign -dv --verbose=4' shows the identifier, team id, and whether the signature is ad hoc. The notarization ticket can be stapled into the bundle so verification works offline; 'stapler validate' checks for it.
A build produced locally on Apple Silicon carries an ad hoc signature, which is enough to run on the machine that built it and not enough to distribute. Command line binaries are subject to the same rules only when they carry the quarantine attribute, which is why a tool extracted from a tarball downloaded with curl behaves differently from the same tool downloaded in a browser.