Ninjas were like backstage players for a play. They play a big part during olden Japan and china. Their gi actually originated for opera backstage workers. To fight is not their actual cup of tea. They are loyal servants to their emperor. They are often sent to kill, steal or spy. Usually they are not like in the movies, fighting people in the lights. They prefer to escape without any ppl knowing their presense. Their aim is to return safely after a mission without anyone knowing. A ninja maybe skilled in making bombs and weapons. But they are extremely knowledgeable in other aspects like geography, weather, disguise, guns, medicine, poison and all the other stuff.
Samurai is a skilled fighter who is supposed to be very loyal to the japanese emperor. They are usually skilled in arts of horse-riding, bow and arrow and martial arts like jujitsu, kenjitsu and iajitsu and a skill "translated from chinese" fire gun techniques. Which were guns.
They both have the common goal, that is to serve the emperor.