I think what you're referring to is known as a KVM (cable or switch), they're generally used to control two (or more) PCs using one keyboard, monitor, and mouse.
Not sure whether they'd work with a PC and an XBox, though, but you'll be able to look it up a bit more easily now you know roughly what they're referred to as!