c. 1300, "vigorously, strongly, forcibly" (a sense now obsolete), from main (adj.) + -ly (2). Meaning "especially, chiefly, principally" is from c. 1400; that of "for the most part" is from 1660s.
he is mainly interested in butterflies
Main Street
Maine
mainframe
mainland
mainline
mainly
mainmast
mainsail
mainspring
mainstay
mainstream