Computer to act as keyboard
USB has two modes: Master and slave.
Usually a device only supports a single mode. E.g. a mouse is a slave, a pendrive is a slave, a keyboard is a slave. A computer is usually a master.
Masters and slaves can communicate with each other.
Slave <--> slave and Master <--> Master does not work.
Master and slave use different plugs to prevent people from making the wrong connection.
Only changing the connector does not change this.
In order to use the PC as a keyboard it will need to be able to emulate a slave. Some USB chipsets can this. Most can not. Those who can usually are connected via an AB connector.
Master only uses A (left side of above picture), or mini-A,
Slave only uses B (right side of above picture), or mini B.
Devices which can do both usually come with an AB connector.
Wikipedia has a nice list of these connectors and interfaces: Notice that some of these support both a and B connections.
Summarising: you will need to have a non standard USB controller/chipset and a special cable. So yes, it can be done. But not by just modifying a cable and running a special program on the computer which needs to emulate the keyboard.