Someone wrote somewhere that the Arduino can serve as Human Interface Device.
So I started experimenting. Doing a Mouseclick or some movement worked. But Keyboard...
C:\Users\SFoX\Documents\Arduino\test\test.ino: In function 'void setup()':
C:\Users\SFoX\Documents\Arduino\test\test.ino:5:3: error: 'Keyboard' was not declared in this scope
Keyboard.begin();
^~~~~~~~
C:\Users\SFoX\Documents\Arduino\test\test.ino: In function 'void loop()':
C:\Users\SFoX\Documents\Arduino\test\test.ino:10:3: error: 'Keyboard' was not declared in this scope
Keyboard.press('a');
^~~~~~~~
exit status 1
Compilation error: 'Keyboard' not found. Does your sketch include the line '#include <Keyboard.h>'?
What model of Nano? There are many different Nano models these days, it's very confusing.
If you mean the "classic" Nano V3 (atmega328) then you are out of luck. This type can't be HID.
If you want something of a similar size and inexpensive, try Arduino Micro or Sparkfun Pro Micro (don't confuse with Pro Mini) or a clone of one of those models.
Did you read the link posted by @UKHeliBob ? It's a little out of date because there are other chips used in Arduino boards that will also do HID these days, but not all. Look for one based on a chip which has the "native USB" feature.
If you want a small formfactor and don't need many IO-pins
The SAMD21 Seeeduino XIAO.
Seeeduino offers more microcontrollers which are called "XIAO" so you have to carefully look if it is a SAMD21-type
USB is high-speed (even at USB2.0) and a pretty complex protocol.
Remember just plug in anything and it rows up functioning with a lot of different devices all using the one and the same bus.
This requires to obey a lot of standards at high speed. The easyness of use for the consumer is bought with high complex silicon just for making the USB-bus work. The older microcontrollers just don't have this complex USB-logic inside.
I remember PS2 sockets for keyboard & mouse. They were just serial ports, I think. They were colour coded, as were the plugs on mice & keyboards, so I guess their purpose was configured in the operating system and they were not "Universal".