Both “quantum mechanics” and “quantum physics” mean the study of subatomic particles. But “quantum mechanics” is more specific. It’s the term used for the field once it was formulated into mathematical laws. Then, it became a kind of mechanics. Prior to the development of mathematical laws governing subatomic particles, the field was called “quantum theory” or “quantum physics.” The distinction between “quantum mechanics” and “quantum physics” is observed by physicists but not necessarily by lay people.
More detail on the difference between quantum mechanics and quantum physics
In the early 1900’s, physicists, through experiments, discovered that atoms and their components followed different laws from those of ordinary objects like tables and chairs. The mathematical laws governing the movements and forces among ordinary objects is known as “classical mechanics” or “Newtonian mechanics.” For example, Force = Mass times Acceleration is a mathematical law of classical mechanics.
Drawing of a photon (in green) being emitted from carbon molecules. [Image source: Nancy Ambrosiano, Los Alamos National Laboratory, July 2017 News Release, “Single-photon emitter has promise for quantum info-processing,” (Public domain)]
When physicists realized that quantum particles do not follow the laws of classical mechanics, they called the new field “quantum theory.” At first, physicists developed quantum laws which were heavily verbal, rather than highly mathematical.
In the 1920’s, physicists developed mathematical laws which describe quantum behavior. In particular, Erwin Schrodinger and Werner Heisenberg developed the key mathematical laws governing quantum particles (Schrodinger’s Wave Equation and Heisenberg Matrix Mechanics). At this point, physicists began calling the new field “quantum mechanics” on the model of the phrase “classical mechanics.”
The term “quantum mechanics” means the same thing as “quantum physics” though the term “mechanics” emphasizes doing calculations.