Beans and brown bread were a staple in colonial New England. At Plymouth Colony in 1622, the local Native Americans baked corn bread in earthen pots, and called it mazium. When the Pilgrims sojourned in Holland before emigrating to America, they got accustomed to eating dark breads made with course grains such as rye. The Plymouth colonists planted barley, and mixed its flour with corn meal to invent brown bread. The Native Americans also baked beans before the Pilgrims arrived, using maple syrup as the sweetener instead of molasses. Thus, most likely, baked beans and the original bean pot were Indian inventions adopted by the English Colonists.
Molasses is a byproduct of processing cane sugar, and is used as an ingredient in the distillation of rum. Boston became a manufacturer and exporter of rum in the late-1700s. Boston Baked Beans, or baked beans with molasses and salt pork, likely evolved into this new recipe at that time.
Related, Boston was then part of the Triangle Trade, an international trading system involving slaves, rum, fish, raw materials, and other finished goods. Slaves and molasses (or sugar) were imported into Boston from the West Indies, with the molasses used for the production of rum. Raw materials and rum from Boston were exported to Europe, with finished goods imported in return. Europe traded goods with the Slave Coast of Africa. Captured slaves were then sent to the British Sugar Colonies in the West Indies, thereby creating what resembles an upside down triangle on a map of the Atlantic Ocean. Boston accumulated great wealth from the Triangle Trade.
In modern times, Boston became nationally known as Bean Town as a result of a publicity stunt. A large event took place on July 28-August 3, 1907 that was called Old Home Week. About one million stickers (a new invention at the time), with an image of two hands clasped above a bean pot, were distributed to promote the event. An article in the April 25, 1907 Boston Globe describes the sticker:
"The sticker is in the form of an irregular seal about 1-3/4 inches in diameter, the lettering and design being in embossed white and the background a brilliant red.
In the center of the seal appears a typical Boston bean pot surrounded by two clasped hands, the two signifying the fact that Boston will not only be ready to extend the 'glad hand' to the homecomers during the reunion week, but that there will be something more substantial in the way of entertainment than a mere greeting."
Historic societies were actually very upset that a bean pot was used as a symbol for Boston instead of local patriotic symbols, as bean pots were essentially just a stove implement or tool used by common folks. Beans were inexpensive, and a means of sustenance for the many poor immigrants in Boston.
Postcards provide more supporting evidence about the stickers being the main source of the Bean Town nickname. That summer, many postcards were published with slogans such as You don’t know beans until you come to Boston; Bigger, Better, Busier, Boston [with an image of a bean sprout]; and Souvenir of Boston and Vicinity, Won’t You Have Some? [with an image of a bean pot]. And, importantly, some Boston postcards were originally printed with a typical tourist sight, and then later put back through the press with the Old Home Week logo printed on them in blazing red.
Seventeen years earlier on August 11-16, 1890, the Twenty-Fourth National Encampment of the Grand Army of the Republic, a Civil War veteran’s reunion, took place at Boston. The Beverly Pottery Company of Beverly, Massachusetts supplied thousands of small ornamental bean pots as souvenirs for the troops, and this helped to make the bean pot a symbol for the City of Boston. In about 1896, a bean pot was placed atop a clock in the gallery in the old Common Council Chamber in Old City Hall, validating that Beverly bean pots had some impact in cementing the symbol for the city of Boston. Beverly itself was nicknamed Bean Town at one time, and legend has it that a schooner full of beans landed there in the early 1700s, and supplied the whole town with them. This supposed event also gave its inhabitants the nickname, Beverly Beaners.
source : http://www.celebrateboston.com/culture/bean-town-origin.htm