Shadow Mario first appeared in Super Mario Sunshine where he kidnapped Peach and framed Mario for misshapes while the two were on vacation on Isle Delfino. He was reveled to actually Bowser Jr. in disguise by use of a Magic Paintbrush that he got from a strange old man in a white coat to kidnap Peach as Bowser had convinced his son that Peach was his mama.
Much like Metal Mario, Shadow Mario has become a separate character from both Bowser Jr. and Mario. He appeared as a playable character in Mario Golf: Toadstool Tour. Despite using the paintbrush in spin-offs, Bowser Jr. does not tend to turn into his alter ego.
Shadow Mario only appears in Brawl as a sticker.
In Smash 4, Shadow Mario appears as Bowser Jr.'s Final Smash, Shadow Mario Paint, where he transforms into Shadow Mario and paints an orange "X" on the screen that will damage any caught in the "X"'s hitbox. As the Koopalings are alternate skins of Bowser Jr., they are also able to transform into Shadow Mario despite not having done so before.
Shadow Mario also appears as a trophy as a Final Smash in the Wii U version.
In Ultimate, Shadow Mario appears once again as part of Bowser Jr.'s Final Smash, Shadow Mario Paint.
Shadow Mario also appears as a Spirit.