The AirTag's chirping sound is typically associated with being separated from its owner, as part of the built-in anti-theft and tracking features. But in your case, it's puzzling as it seems to chirp while being close to you. Let's figure this out.
First, ensure that the AirTag is properly linked to your Apple ID. You can check this in the "Find My" app on your iPhone. If it's not properly linked, you might want to reset your AirTag and link it again. To reset, press down the battery cover and rotate counter-clockwise, remove the battery, then reinsert it while pressing down four times. You should hear a sound after each press and another when you've successfully reset.
Secondly, consider if there's any possibility that your AirTag could be sharing a connection with another device you own. If this is the case, that device may be out of range, causing the AirTag to chirp.
And just to rule out any other possibilities, please make sure your iOS is updated to the latest version, as it might be a software glitch that has been fixed in the newer updates.
References: