The endosymbiosis theory explains how cells evolved from prokaryotes to more complex and useful cells or eukaryotes. Millions or even billions of years ago, only prokaryotes existed among each other. Prokaryotes don't have organelles. Different types of prokaryotes had many unique functions. There were also these huge prokaryotes that could engulf smaller prokaryotes. The prokaryotes stay alive even after being engulfed and together, this forms a complex cell. All the functions of each individual prokaryotes function as one complex cell or eukaryote. Similar to evolution, cells start off as a simple prokaryotes and they develop and become more useful or thrive better based on their environment.