Likely Shadow the Hedgehog (PS2, 2005).
Shadow, a Sonic universe anti-hero, is the protagonist. He has a "shadowy companion" (also called "Shadow" in some contexts, or his own shadow/mecha doppelgänger) assisting in combat. Features Chaos Control, gunplay, vehicles, and moral choices across branching levels.
Is this the game you meant? Other possibilities: Devil May Cry (Dante/Trish), Kingdom Hearts (Riku/Ansem), Persona (protagonist/Persona).