Denim was invented in the 1500s in Genoa, Italy to be worn by the sailors in that city's navy. Its name comes from the French phrase "de Nîmes," meaning "from Nîmes," the city where the cotton fabric was made.
The word "jeans" also comes from the French; their word for Genoa is "Gènes." Denim had existed for about 300 years but was never really popular until the 1870s when Levi Strauss chose the cloth to make inexpensive clothing held together by rivets for prospectors, panners and miners during the California gold rush. When denim entered pop culture after teenagers started wearing jeans in the 1960s, many were refused entry to restaurants and cinemas because the fabric was associated with protests.