I see two likely possibilities as to why two compressed files would differ while containing the same compressed data:
The compressed form of the data is different, but both files contain the same uncompressed data. This may be because a different gzip compression level was used, or because a different implementation of gzip was used to compress the files.
The compressed data is identical, but the header of the compressed file differs, e.g. because metadata like the timestamp or original filename (which gzip stores in the header) are different, or are missing in one file. The metadata will differ based on how the compressed file was generated -- for example, compressing a file with gzip
will include a filename and an original filesize, whereas compressing a stream will not.
Either way, you will need to uncompress the file to get a checksum of its contents.