Here's an older post about the same thing in which a MedHelp doctor answered. You could have what Auntiejessie suggests and I'd get checked out for that but the doctor suggests that it also could be priapism. Apparently there are two types, low flow and high flow. Get this evaluated! He also says that prostate inflammation could cause this. Here's the post: https://
www.medhelp.org/posts/Urology/Penis-hard-when-flaccid--pain-in-side-of-penis/show/563504
Is this something new for you?
Does it hurt or feel uncomfortable?
There's something called Hard Flaccid Syndrome, and it's a type of Chronic Pelvic Pain Syndrome -
https://www.urologynews.uk.com/features/synopsis/post/hard-flaccid-syndrome
http://entropy-physio.com/blog/hard-flaccid-syndrome-penetrating-what-we-know
https://www.jsm.jsexmed.org/article/S1743-6095(19)30651-4/pdf
If you think this might be what you have, do some research and talk to your doctor, or a urologist. Not a lot is known about it, unfortunately.