You need to insert a section break at each change of orientation, and use
File > Page Setup to set the page orientation, margins and so on of each
section as you want it.
Sections and changes of orientation can easily trip you up, so you might
find these FAQs useful: