Simply put: if you have a simple rotation (for instance something only rotates around one axis), then you’d use Euler.
When you have complicated rotations , use quaternions.
Suppose you use XYZ Euler and rotate an Object +/- 90°, then you have what is called Gimbal lock; rotating around the X-axis:

is the ‘same’ (direction may be opposite) as rotating around the Z-axis:

When you have a rotation R1 followed by a rotation R2, then the total rotation is quite hard to figure out with Euler, with quaternions its a piece of cake 😉 (You just multiply the quaternion representation of R1 by the one of R2…again: simply put)