Any explanation as to why the imaginary friend of Afro was a ninja even though Afro was a samurai? Or was it just for characterization purpose?
I think it is because he represents the opposite of afro's like the samurai and ninja's in the history, opposites and enemies.Source
Origins of the Ninja:
Japanese folklore states that the ninja descended from a demon that was half man and half crow. However, it seems more likely that the ninja slowly evolved as an opposing force to their upper-class contemporaries, the samurai, in early feudal Japan.
Ninjutsu versus Bushido:
Ninjutsu developed as an opposing force to the samurai code of bushido. Samurai valued loyalty and honor above all else. Going into battle, a samurai would select a single opponent, announce his challenge, list his family pedigree, and then attack. Samurai wore bright colors on their armor to announce their clan identity. Ideally, at least, bushido was noble and highly stylized, but it couldn't always get the job done.
That is where ninjutsu came in: the ninja code valued accomplishing a mission by whatever means necessary. Sneak attacks, poison, seduction and spying were all shameful to the samurai, but fair play by the rules of the ninja."