When I worked for a grocery store the rationale was simple. They had to have stock and prep people there anyway. So being open really cost them nothing. And there are a fair number people who work night shifts. They do not change their schedule on their days off. So it is natural for them want to shop at 3:00AM. Other people are just up late, or early.
For a long time, I took care of my kids during the day and worked late nights. I shopped for groceries in the wee hours of the morning after my shift ended. But, even when I wasn't working, I preferred to avoid the crowds by shopping late at night.
always amazed me the folks who did big shopping at 4:00 am.
figured they hated crowds.