People have been eating pistachios in the land of Israel for a very long time. A paper published in 2002 by archaeologists from the Hebrew University in Jerusalem and Bar Ilan University revealed that they had found pistachio shells, among other nuts and cracking tools, at a site near Gesher Banot Ya’akov in northern Israel - dating from 780,000 years ago.
We don't know what these prehistoric Israelis called their pistachios, but many eons later, somebody wrote the book of Genesis, and provides the first clue: “And their father Israel said unto them, If it must be so now, do this; take of the best fruits in the land in your vessels, and carry down the man a present, a little balm, and a little honey, spices, and myrrh, botnim, and almonds.” (43:11)
In the King James Bible, that word botnim is translated generically as "nuts." If you ask an Israeli, they'll tell you botnim means "peanuts," but your Israeli friend is wrong.
Peanuts were unknown to the ancient Hebrews. They come from South America and only reached Jews for the first time well after the Columbian Exchange. The botnim referenced in the bible were pistachios, as is made clear by the fact that Arabs call them boten to this very day.
How did botnim morph from "pistachios" to "peanuts" in modern Hebrew? Well, for one we Hebrews acquired a synonym for botnim during the time of the Talmud - pistikey - which we took from the Greek pistakion. That is also where English got pistachio from by way of Latin and French. The Greek word comes from the ancient Iranian word pstk’.
Over the years both words - pistikey and botnim - were used to refer to pistachios. Peanuts were not really talked about at all since they were not considered fit for human consumption, until in the late 19th century, Dr. George Washington Carver famously pushed for the use of peanuts as foodstuff. This was facilitated by an advance in peanut farming and processing technology.
The Hebrew farmer and the peanut
In the late 19th century peanuts received the Hebrew name “egozey adama,” a literal translation of their German name Erdnuss, “earthnut” (the name "groundnuts" is also widely used, for instance in Africa).
In Yiddish though, peanuts were called pistake, from the Russian word for pistachio. It is no surprise then that when people started eating peanuts in Mandate Palestine and a Hebrew word was needed for this new snack, some people translated the pistake into botnim, and the word stuck.
This discombobulated the people in the Academy of the Hebrew Language, though. In a discussion they held in 1959, they voted not to capitulate and insisted that people call the peanut egozey adama as the Committee of the Hebrew Language had decided over a generation earlier.
But this was ignored by Israelis and they just use botnim just the same, not knowing that anything was amiss. And by the way, if an Israeli calls you a "boten," he's insulting you, and not by calling you a pistachio or even a peanut. He means you're a moron.