A samurai is a warrior, protector, and leader. A Ninja is someone who practices ninjutsu.
Ninjutsu is covert activities, or if literally translated from the Japanese, “the art of stealing in.”
Ninjutsu came about from Japanese mystics during the rise of the samurai. It didn’t exclude combat, but fighting was only a small part of a Ninja’s total repertoire.
Like so many fun things, the practice was eventually outlawed in the 17th century, but it was still practiced secretly for many years.
Today it’s only practiced as a form of martial art, as far as we know.