We have absolutely no idea where the idea for the death penalty came from as it has been around as long as there have been written laws. Here in the United States, we got the idea from the English who were, of course, the people who founded the colonies that became the United States. The death penalty was extremely common all over Europe in those days.
The first legal code that we know of is the Code of Hammurabi, which is believed to have been written in about 1700 BC. That set of laws prescribes the death penalty for a broad variety of offenses. The fact that it does so strong implies that the death penalty was in widespread use even before that. We also know that the death penalty existed in many different societies, which again implies that it was used in many times and places.
Because of this, we have no way of knowing where the idea came from. It has been around for as long as written laws have been.