How important is it to choose the right editor on journals that require you choose an editor? Not sure whether this is common practice, but in the journal to which I am submitting a manuscript (JMEMS), I have to choose an editor. I am not 100% sure whether this is a mandatory requirement, but it seems like there are over 40 editors. 

I know some of the editors have good relationships with my advisor. For this paper, I am solely responsible for publishing the paper. My advisor is not helping me much, and I have not directly submitted paper before.

The journal also doesn't mention who is in charge of what research areas. I can possibly guess, but I will have to do a lot of legwork to figure out the best match.

How critical is choosing the correct editor? Is it best to choose editors who know my advisor?
The editor is the person responsible for directing your paper to a competent reviewer. Taking that into account, I'd strongly suggest you choose the editor that is most related to your research area, because he will have more contacts of experts in that field. Your advisor's knowledge on some editors can probably help you discover which ones hold this position, but you really should have this information on all of them. E-mail the journal and ask for this information before you do the legwork.