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.
Entries linking to mainly
main adj.
early 13c., "notably large, bulky, or strong" (a sense now obsolete), from Old English mægen- "power, strength, force," used in compounds (such as mægensibb "great love," mægenbyrðen "heavy burden;" see main (n.)), probably also in part from or influenced by cognate Old Norse megenn (adj.) "strong, powerful, mighty."
Sense of "chief, principal, prime" is from c. 1400. That of "principal or chief in size or extent" is from 1590s. Main chance "opportunity of enriching oneself" is by 1570s, from the game of hazard. Main course in the meal sense attested from 1829. Main man "favorite male friend; hero" is by 1967, African-American vernacular.
-ly 2
common adverbial suffix, forming from adjectives adverbs signifying "in a manner denoted by" the adjective, Middle English, from Old English -lice, from Proto-Germanic *-liko- (cognates: Old Frisian -like, Old Saxon -liko, Dutch -lijk, Old High German -licho, German -lich, Old Norse -liga, Gothic -leiko); see -ly (1). Cognate with lich, and identical with like (adj.).
Weekley notes as "curious" that Germanic uses a word essentially meaning "body" for the adverbial formation, while Romanic uses one meaning "mind" (as in French constamment from Latin constanti mente). The modern English form emerged in late Middle English, probably from influence of Old Norse -liga.