Besides the classic 'springlock victims' theory (which has very little going for it, at this point), the most popular idea seems to be that they are agony entities born from particular tragic events on the timeline (or a 'wickedness entity' in Shadow Freddy's case, I suppose). Many people seem to think Shadow Freddy comes from the MCI and RXQ comes from SAVETHEM. Or vice versa, or maybe Shadow Freddy comes from Charlotte's death, or something.
I don't think these theories are right. They feel a bit too loose, random, improvised, like an answer that's just trying to make the most of what information you have, but doesn't quite feel intentional. I won't bother to sit around poking holes in them, but suffice to say, any theory that gives relevance to the SAVETHEM murders is dead in the water. Instead, I'll just pitch my alternative.
~
Were the FNaF3 cake minigames always meant to be memories?BV didn't exist at the time, of course, but FNaF3 was definitely playing with this concept of memories and emotions lingering. That's the main idea of Fazbear's Fright, I think, it's where all the Freddy's memorabilia is brought together, all the memories from the past dug up and collected in one place. That's the actual reason for all the hallucinations (though the poor ventilation is probably also a contributor). The Phantoms have always been obviously paranormal, they have a tangible effect on the world (specifically, your audio and ventilation systems). They are hallucinations ("It's all in your head"), but they aren't just hallucinations. Paranormal hallucinations have been a recurring theme since FNaF1. They act similar to, say, "the yellow thing" from Into the Pit, being a weird mix of hallucination and tangible entity.
This is all to say, I suspect that at FNaF3, Scott already had the concept of lingering memories/emotions, and the manifestation of those memories into pseudo-hallucination entities. It's arguably the main focus of FNaF3, aside from Springtrap. That makes me think that Scott already knew what the Shadows were, as well. The Shadows are the same 'type of thing' as the Phantoms; arguably, the Phantoms exist to elaborate on the concept of the Shadows. They're paranormal hallucination entities that come from memories (see, again, ITP's "yellow thing" for an extremely straightforward exploration of the concept). This all makes it likely that the cake minigames were always meant to be memories (which also fits with the idea that they're meant to be actual haunted arcades in-universe). The minigames hint at the nature of the Shadows via the weird shadowy BBs and cupcakes and whatnot.
This is where RXQ's minigame comes in. It's a memory of RXQ in front of the stage at Fredbear's, taking the role of Spring Bonnie's literal shadow. But I don't think this is 'just a memory' of RXQ, I think it's really him. This is RXQ's first (only?) plot-relevant appearance, it'd be weird if it weren't actually RXQ. We know Shadows come from memories anyway, so it's much simpler to just say it's the real RXQ in his 'natural habitat', so to speak.
But then, doesn't that imply that RXQ originates from this particular memory of the shadows at Fredbear's?
All FNaF4 did was recontextualize the memories. Rather than just the scattered remnants of all the guests from Freddy's past, now there's a central nexus point where it all emerges from, the bite victim. Now, we know where that Fredbear's memory comes from, it comes from BV. BV is afraid of the shadows of the springlock animatronics, he literally collapses in fear of them. It's extremely natural to suggest, then, that the shadow animatronics are simply the shadows from this memory, given life by BV's fear.
I'm not sure that RXQ being a literal shadow is something we can take for granted. Yes, these memory entities are generally associated with darkness or blackness, especially in Frights, but this isn't particularly consistent, and being a literal shadow is still a unique case. My theory is, as far as I know, the only really satisfying explanation for why RXQ is what he is. Shadow Freddy is different, so I'm a bit less confident he comes from the same place. But even if he isn't a literal shadow, he's still very shadow-themed, and he still has "shadow" in his name. He can still be 'William's wickedness', it's just that this is his origin, it explains why he's a shadowy figure who looks like Fredbear.
~
I've thought this for years, but the Talbert Files gave me extra confidence (when we were all sure they were real), since they clearly imply the Shadows existed before the MCI. Specifically, at the time of the MCI investigation, William is stated to have already been dignosed with Schizophrenia for having seen the shadows.And for those hung up on RXQ looking like Toy Bonnie...