USB Switch for Keyboard and Mouse (KM)
They are called USB switches, USB Sharing Switches, or USB Peripheral Sharing Switches. The mechanical details of the switch are terribly simple since there are just 4 wires that need to be switched between the two computers for the USB connection (and really only 2 of them where the data passes.. the other two are for power).
If you go the do-it-yourself route, you could probably manage the power for each device separately (red and black wires in the usb wire) with a usb wall charger. And then use a Quad Pole Single Throw switch for the data connections to each device/computer. I haven't tried it myself so YMMV.