early 13c., "scarlet dye made from insects" (late 12c. in surnames), from Old French grain (12c.) "seed, grain, particle, berry, scarlet dye" (see kermes for last sense), from Latin granum "seed, a grain, small kernel" (see corn (n.1)).
As a collective singular meaning "seed of wheat and allied grasses used as food," it is attested from early 14c. Extended from c.1300 to other objects (e.g. salt, sand). As a unit of weight, from 1540s. Used of wood (1560s), from the arrangement of fibers, which resemble seeds. Hence, against the grain (1650), a metaphor from carpentry: cutting across the fibers of the wood is more difficult than cutting along them.