By any chance did your iMac come with a different keyboard that may still be in your house or office? The reason I ask is that I once encountered a similar issue where I chose to use a different keyboard than the wireless version that came with the iMac. I put the wireless version safely away in the iMac box, and months later received a keyboard battery is low message which I thought was strange since I was using a wired keyboard. After lots of troubleshooting I finally realized that the message was the result of the battery running low on the wireless keyboard that I had accidentally left ON when I placed it in the box. Turning it off solved my problem.
I suggest opening the Bluetooth system preferences to see whether a wireless keyboard shows up in the list of devices connected to your iMac. If there is a wireless keyboard in the list you can simply remove it, although I also suggest locating the mystery keyboard so that you can either turn it off or charge it.
If you continue to have problems with the message it would be helpful to know what model 21.5-inch iMac you have, the version of macOS it is running (your profile indicates 10.13), and the model of wired keyboard you have currently connected. For the past decade or so the default keyboard that ships with iMac's is wireless, so it's highly likely you have/had a wireless keyboard associated with your iMac at some point which may be causing the low battery message to appear. The current Apple Magic Keyboards can be used wirelessly, or they can be plugged into a USB -> Lightning cable to both charge the internal battery and work in a USB wired mode. This Apple article provides information on how to identify the various keyboard models.
How to identify your Apple wireless mouse, keyboard, or trackpad - Apple Support