Arduino master to arduino slave code not working correctly

Which board are you using as a reference ? The Arduino Zero or the Arduino MKR Zero or the Arduino M0 (mzero) ? There is a big difference between them.

Arduino Zero: https://store.arduino.cc/products/arduino-zero
Arduino MKR Zero: https://store.arduino.cc/collections/mkr-family/products/arduino-mkr-zero-i2s-bus-sd-for-sound-music-digital-audio-data

The Zero has one I2C bus defined here: https://github.com/arduino/ArduinoCore-samd/blob/master/variants/arduino_zero/variant.h
Sercom3 is used.

The MKR Zero has one I2C bus defined here: https://github.com/arduino/ArduinoCore-samd/blob/master/variants/mkrzero/variant.h
Sercom2 is used.

The common Wire library that uses those settings is here: https://github.com/arduino/ArduinoCore-samd/blob/master/libraries/Wire/Wire.h

I have used information from Adafruit in the past to add ports, but you might use a combination that does not work. Can you stick with the Arduino settings ?