The Nephilim were a race of giants noted in the Torah existing both before and after the Flood. The first mention of these giants is in the time that "the sons of God" began to take wives from among the "daughters of men." At that time, they became the "mighty men of renown" that were the stuff of legends for ages to come ("men of old").
That Moses refers to the sons of Anak as Nephilim confirms what was recorded in the annals of the days of Noah. That there are giants after the Flood is indicative that at least one of this lineage was upon the ark. Since the sons of Anak lived among or near Canaanites, it is assumed that they were descended from Ham. Logically, the wife of Ham at least carried the genes allowing the infestation of Canaan by this race.
Due to their size, among other things, the Anakim had come to dominate whatever lands they settled. They were called "Ennim" (Heb: "dreaded ones") by the Moabites who encountered the remnants of the tribe when they settled the land during the days their cousins, the sons of Isaac and Esau were occupying much of the land around them. They were known as the "Zamzummim" by the Ammonites who with their cousins the Moabites, had settled the land.
The last known members of the tribe were found in the land of the Philistines, including their infamous champion Goliath of Gath, who died at the hands of young David.
The word "Nephilim" is a transliteration that is used in some translations of the Hebrew. Context in the second use of the word provides the translation "giant," though that is an interpretation. Literally, the name "nephilim" means either "fallen ones" or "Ones who fall upon." This leads to the interpretation that they are offspring of human women and "fallen angels." The context strongly leans toward this interpretation, though it is inconclusive.
In the years after the Fall of Man and the murder of Abel by Cain humanity began to multiply and populate the known world. While Cain was establishing Enoch, the world's first city, the sons of Adam, through Seth began to "call upon the name of Yahweh." At least some of the growing population of the world had returned to the ancient ways of the Creator. These may have been the "sons of God" that began to eventually take "daughters of men" (the women of the Cainites). However, these may have been the results of unnatural union between fallen angels (demons?) and human women.
However, during this time, there arose a tribe of prominent leaders that controlled the direction of society. They were looked up to as "men of renown." Whether or not they were "worshipped" instead of Yahweh is unknown, but they lead the world that then was into a perpetual state of violence. These men were the Nephilim. Though the great Flood was sent to destroy the results of their influence, it did not destroy their lineage.
As the sons of Ham migrated to the coast of the Great Sea, a man named Anak and his tribe settled in the plush Jordan valley. A few years before Abram and his family came down from Haran, five major cities in the valley revolted against the foreign domination of Chedorlaomer and his allies. In putting down the rebellion the Raphaim and the Emim (that is, the giants and the nephilim) were struck down by the superior forces of the allied armies.
Being forced from the Jordan valley, the "giants" regrouped and settled lands to the south. Years later, as the descendants of Lot multiplied into two nations, Moab and Ammon, would succeed in driving them west across the Negev to the land south of the Valley of Hinnom. It was there that the fearful spies would encounter them and their large fortified cities.
Though the Israelite forces eventually were able to eliminate the threat of the Nephilim, there remained a remnant among their cousins the Philistines. David and his mighty men would be instrumental in killing five of their champions who lived in and around the city of Gath.