Keyboard USB transform
You want a keyboard adapter or keylogger or man in the middle attack.
A microcontroller or SOC that can do usb peripheral as a usb hid keyboard, and that can either do PS/2 reading or USB host for a usb hid keyboard. The PS/2 reading is much easier. Some modern usb keyboards still work with a USB to PS/2 physical adapter.
A RPi can do it as it has usb host and usb OTG capability. Many microcontrollers can do it. Even some without native usb like V-Usb on a attiny. The devil is in the detail and timing. And coding. You may want to use multiple microcontrollers to break up the project, one for reading the keyboard and one for emulating a keyboard. Good luck.