M and W correspond to A- and B-model in string theory. Mirror symmetry not only replaces the homological dimensions but also the symplectic structure and complex structure on the mirror pairs. That is the origin of homological mirror symmetry.