So, I programmed an ATmega32U4. When I connect the device, it doesn't run the code. Instead, it gets recognised as an ATmega32U4 chip in Windows' Device Manager.
To get the code running, I have to open Atmel FLIP and open USB and then have to press the start application button after which it gets recognised as a HID in Device Manager and works as intended. I don't know why and what is happening.
The reset is pulled high with a 10 kΩ resistor and the HWB pin is pulled down with a 10 kΩ resistor, and the chip has the factory bootloader on it (if this helps).
Pulling down HWB is what you do if you want to start the bootloader built into the ATmega32U4. It sounds like you want to run your own code instead of running the bootloader so you should pull HWB up, or disable the HWBE fuse.