I was fighting some drowneds in the ocean and an axolotl started attacking them, too. I killed the drowneds and swam away but then realized that I had the regeneration effect for a couple seconds. I can't think of any other reason why this happened.
Comments 2
From the 1.17 changelog:
When a player kills a mob that the Axolotl was attacking or being attacked by, the Axolotl will show its appreciation by granting the player temporary Regeneration and removing any Mining Fatigue effects
This is intentional due to the fix of MC-208703.