GZip doesn't produce the same compressed result on macOS vs Linux

Note that the compression algorithm (Deflate) in GZip is not strictly bijective. To elaborate: For some data, there's more than one possible compressed output depending on the algorithmic implementation and used parameters. So there's no guarantee at all that Apple GZip and gzip 1.6 will return the same compressed output. These outputs are all valid GZip streams, the standard just guarantees that every of these possible outputs will be decompressed to the same original data.

The format should be very stable, but see its description. It contains a field for operating system ID. Obviously that will differ for MacOS and Linux and FreeBSD and...

Gzip format is standard, the implementation - not necessarily. Wikipedia lists at least 5 free/oss independent implementations and there are also proprietary ones. Apple clearly outputs a different version string.

The format and the algorithm both allow for a lot of freedom and a lot of design choices that are either matter of taste and/or work better in different use cases.

See Zip Files: History, Explanation and Implementation

I generally would expect the results to be the same between different implementations only for a small percent of small-ish files.