I found a solution.
An example you can find at https://www.waveshare.com/wiki/BMM150_3-Axis_Magnetometer_Sensor (the one linked from Example Demo) with a proper modification worked with BMM150 in Env II Hat. Here is the procedure.

Download the zip file from the Example Demo link. Open bmm150_Arduino.ino under Arduino > bmm150_Arduino Search Wire.begin() in the code (you can find one in the line 149) Change it to Wire.begin(0, 26)
This is necessary if you are using a Hat version of ENV II HAT, which is connected to the GPIO pin side of the M5Stick variants. If you are using ENV II Hat connected the Grove port, you don't need to change it.

After this modification, the code should work.