The titans were created over a hundred years ago as a weapon against humanity by Dr. Kichirou Moto. His motivation was revenge for his murdered wife and son from religious zealots that did not like the fact that Dr. Kichirou Moto was conducting research that could be viewed as being sacrilegious. On the night of the murder, Dr. Kichirou Moto home was set on fire by a religious group in the hopes of killing Dr. Moto. Unfortunately for the zealots, Dr. Kichirou Moto was still at his laboratory conducting research throughout the night. Upon returning home, Dr. Kichirou Moto watched in horror as his house burnt to the ground with religious zealots surrounding it. He knew that if he approached them it would mean certain death and he could no longer obtain revenge for his murdered family. He went into exile and constructed a hidden laboratory so that he could continue his research. He was able to develop a mutant potion that could be introduced into the water supply so that it would turn humans into enormous, but mindless killers. His justification for his actions was that humanity was becoming too religious and needed to be exterminated. In place of humanity, the doctor created a new race with individuals who were not a part of any religious order and who did not believe in the existence of a god. To avoid being killed by the titans that he created, he gave his followers as well as himself a potion that would allow them to shift into titan form that was many times stronger than normal titans.
These shape shifting titans built a base so that normal titans could not pose a danger to the shape shifting titans. Their goal was to wait within the walls until humans were all eliminated by the titans. This plan would allow the shape shifting titans to avoid battle with humans and thus saving them from losing lives on their already low numbers. The problem was that their hidden location was discovered by a sizable human army which could have meant the total destruction of these shape shifting titans. To avoid this, it was agreed that the shape shifting titans should stay in human form and relocate to a new location.
At the time, these shape shifting titans could not destroy the humans completely because they had well equipped and highly skilled fighters within their army. As time passed, humans began to take their titan threat less seriously so that their defense force were smaller in number and were less skilled. Sensing this weakness, the shape shifting titans decided it was the right time to attack and make an entrance for the regular titans.
Dr. Grisha Yeager is a shape shifter himself who fell in love with a non-shape shifter. Although Dr. Yeager is a shape shifter, he did not share the hate that his fellow shape shifters had for humanity. This is evident when he cured a plague that was befalling humanity. After the attacks on wall rose which he was not notified beforehand, he injected his son with the shape shifting potion so that he would not die as easily as his wife did.
After the initial attacks, Dr. Kichirou Moto sent in spies into the human military to analyze human tactics, weapons, and military numbers. Feeling confident that humanity was still not prepared to engage the titans, a second and third attack were planned on walls maria and sina.
The attack on wall sina failed due to a change of heart from a handful of shape shifting spies who changed sides.
Eren Yeager discovered that his father, Dr. Grisha Yeager was murdered for aiding humanity and giving Eren along with others the shape shifting potion to defend against Dr. Kichirou Moto.
The recipe to a vaccine was found inside the basement of Eren's old house to prevent further titan mutations during battle. Dr. Grisha Yeager was able to create the vaccine before losing his life to Dr. Kichirou Moto.
The ending involves Eren Yeager, Mikasa Ackerman, allied shape shifters, and the remaining human military destroying Dr. Kichirou Moto and his followers.