First, ‘d strongly advise against just connecting the output of two amplifiers (or receivers) to the speakers. Even if you think you’ll never do it, I’m confident that at some point you will either accidentally leave one system on and then turn on the other, or someone in the home (friend, mother-in-law, etc.) will want to listen to something on one receiver while you listen to something else on the other.
The use of an A/B selector prevents you from accidentally sending inputs from both amplifiers into the speakers (which could overload and blow the speaker, or feed back to the other amplifier and blow that). There are several A/B selectors available, both manual and automatic. With a manual selector, you press a button to switch the source. With an automatic model, if the selector senses power on either input, it will direct that input to the speakers. If it detects power on both, it will direct one of them (usually the A input - your home theater in this case) to the speakers.
The use of an automatic selector lets you never again think about what you want to play over your speakers - the right thing will always play.
Alternately, you could use a receiver which has second zone capabilities. That will allow you to share a single set of sources between the rooms, and get the equipment out of the second room. It’s generally a more elegant and cost effective solution than an A/B selector. You will need to make sure the second zone remote is capable of reaching the receiver (either an RF remote or an IR extender).
My specific recommendations would depend on your specific application, budget, and existing equipment.