The keyboard works through your USB hub. Connect an external drive as well, and the Mac reports that a device needs more power or that USB devices have been disabled. Start with the connection and power supply. That message alone does not tell you the drive is damaged.
Change one thing at a time
Finish file activity and safely eject any mounted storage before unplugging it. If a transfer has failed or the drive has already disappeared, avoid a series of hurried reconnects. Note which device and connection produced the warning.
Apple recommends trying another Mac port and, for a device connected through a hub, connecting it directly to the Mac. Use a cable suitable for that device. Test with a simple arrangement first so you can tell which change helped.
Check a powered hub's own supply
If the hub is designed to use an external power adapter, check that its intended supply is connected. Follow the manufacturer's specifications; a plug that fits is not enough to establish compatibility. A hub powered only from the computer has no separate supply to reconnect.
Suppose the drive works directly but triggers the warning through the hub. That narrows the investigation to the hub connection and its power arrangement; it does not prove exactly which part is at fault. Keep that observation for support, along with the Mac, hub and device models.
Formatting the drive is not a remedy for insufficient USB power and risks losing its files. If the warning persists after the basic checks, consult Apple or the accessory maker before replacing hardware or attempting further changes.