Get two microcontrollers with USBD peripheral and connect them using SPI or UART. Write two firmwares for these microcontrollers. Probably two Raspberry Pi Picos would be the easiest way to implement that project.
You also might want to use optical isolators between these microcontrollers, instead of wiring them directly. Just connecting grounds might be wrong, because different computers might have different grounds.