Mario must be on the ground to enter the door.
It takes some time to get up to full speed, and Mario's top speed oscillates, but you don't really have to know about that when you are beginning. Just hold X or Y and press left or right on the D-Pad.
Moves Mario on the overworld and in game, changes selections on selection screens, etc. (Note: this does not work on all areas or levels).