Most people just use a math library that use quaternions for rotations. If you like a very gentle introduction to them I can recommend the following videos:
Moving to 4×4 Matrices
The Origin of Dot and Cross-Product
The full playlist can be found here.
Preview image from Wikipedia: https://en.wikipedia.org/wiki/Quaternion#/media/File:Quaternion_2.svg