Back before Freddy Fazbear's Pizza was in existence, the company was called Freadbear's Family Diner. At the restaurant, a psychopath made regular visits to murder helpless little children. Puppet, who was the only animatronic that was truly alive at that time, decided to take action. It stole four of the children's bodies and stuffed them into the suits of the other animatronics, giving them life (as seen in the Give Gifts, Give Life minigame). It told the other animatronics to help apprehend this psychopath, but that plan didn't go as well as Puppet hoped. The animatronics couldn't do anything except stand by and watch the psychopath do his dirty work, for if they made any move to attack him or stop them, the owners might think that they were malfunctioning and have them decommissioned. Alas, the place was shut down and the animatronics were scrapped due to the smell of death and decay that was coming off of them. (As well as the blood and mucus oozing out of their mouths and eyes.)
The company was placed under new management, and Freddy Fazbear's Pizza came to be. The owners made the place completely kid friendly; they had the new animatronics, as well as one that gave out presents (Puppet) and one that gave out balloons (BB). I find it interesting that they newer models of the animatronics had facial recondition and were tapped into a criminal database; it was if the new owners had known that there had been reports of missing children in the old establishment, and were taking measures to make sure that it didn't happen again. (Although they weren't being open about what had happened, since that would hurt their business.)
Well, Puppet had moved with the establishment, and it knew that the killer hadn't been caught yet. So, it put another plan into motion. Since the killer had been working for the establishment before (wearing a Bonnie suit to disguise his real identity) and had been working on the day shift, it reprogrammed the newer models of the animatronics to become aggressive towards all of the adults, since it didn't know which adult was the murderer. It reasoned that one of the employees was the killer, since most of the employees had moved with the establishment. Unfortunately for Jeremy, the only employee they could try to effectively stop was the night watchman, since no other person would be there to witness them attacking him.
So, he stays there for five or six days and receives his pay. After he receives his paycheck, he complains to the management that the animatronics were trying to kill him. They decide to move him to the day shift, since a position had just opened.
Now, who was the murderer, you ask?
If you think about it, he would be the prime suspect. On the fifth day, Phone Guy tells you a position had opened up. Fritz Smith had been working on the day shift, and had been fired to make room for Jeremy. He had tried to get rehired on the night shift, but was again fired. Well, by then, he had gotten really ticked off at the establishment, and decided to get back at them. He put on the only spare suit, the Golden Freddy suit, lured five kids from the birthday party he had been attending into the employees only section, and murdered them, stuffing their bodies into the newer models of the animatronics in order to get the place shut down.
This had been what the animatronics were waiting for. Once Fritz had taken off the suit, one of the old animatronics from the original establishment, Foxy, lunged at him and clamped his jaw down on Fritz's head, his sharp teeth going through his skull and tearing through his brain.
"I-it's amazing that the human body can live without the frontal lobe, ya know?" - Phone Guy
Well, the establishment couldn't hide that, so they had been quarantined for a while before reopening in the old building that used to house Fredbear's Family Diner.
Then the events of FNaF 1 took place. The newer models of the animatronics were scrapped and the old models were refurbished. The animatronics didn't realize that they had stopped the murderer, though, and still continue to try to destroy any adult who takes the night shift.