Beaner is a slang term, widely regarded as derogatory, that refers to Mexicans or also to Hispanic people in general, used too for Hispanic-ancestry's people. The term originates from the prevalence of pinto beans and other beans in Mexican cuisine.
According to The Historical Dictionary of American Slang, the word was first seen in print in 1965, although the term has reportedly been in use at least since the 1940s (perhaps having evolved from previous slurs such as "bean-eater" and "bean-bandit" that were in use since as far back as the 1910s.) 
Although the word is generally considered pejorative, its usage is not always overtly offensive and can be fairly benign depending on the context (similar to the term "frog" for a French person.) Though perhaps once considered strictly offensive, it appears that the term may be going through a phase of melioration, where the negative connotation of an ethnic slur is "reclaimed" by those against whom it is directed and used in a neutral or even positive manner.
- Booth, William (September 28, 2005). "The Mouth of Mencia". The Washington Post. Retrieved April 26, 2010.
- "San Diego's top Latino cop retires". The San Diego Union-Tribune. September 1, 2005.
- "Pedro deflects the barbs; Racist comments don't faze Sox ace". The Boston Herald. September 14, 2000.
- "You are what you eat... arguably: John Sutherland on national nicknames". The Guardian (UK). July 31, 2000.