theorem is the syntax defined by Lean 4 itself (sometimes referred to as "Lean core").
lemma is an alternative syntax provided by mathlib, which is a library maintained by the community.
If your project has mathlib as a dependency, you can import Mathlib.Tactic.Lemma to gain access to the lemma syntax in your file. If your project does not depend on mathlib, you should use theorem.