From the Super Mario Wiki
Retrieved from "https://www.mariowiki.com/index.php?title=Magic_Door&oldid=2268782"
Magic Doors are special doors that appear only in World 4-6 of Super Mario Bros. 3 and its remakes, Super Mario All-Stars and Super Mario Advance 4: Super Mario Bros. 3. Upon entering one of the doors, the enemies and scenery (Blocks, Warp Pipes) of Giant Land will be replaced by their normal-sized counterparts. Likewise, entering a Magic Door when the normal-sized enemies and scenery are in effect will revert the level to its giant-sized form.
The two variations of Level 4-6 also have a few minor differences in terms of Hidden Blocks and 1-Up Mushrooms. As such, players can explore different segments of the level in both sizes to find additional bonuses. However, the Magic Doors of the level are entirely optional and can be ignored if the player chooses to do so.