I think Shazam is a great movie but I think its lackluster box office can be boiled down to a few elements:
1. A lack of name recognition. Even though Captain Marvel/Shazam has been around since Superman's earliest adventures, he's not half as well-known.
2. The costume. Overall, I thought the Shazam suit looked okay but in today's superhero movie renaissance, it could ahve looked better. It did look very cheap in some shots and the fake muscles did Levi no favors (and the irony is that he actually bulked up a lot but the suit was obviously padded).
3. A lack of star power. Levi is a great actor and maybe future appearances as Shazam and a few more seasons of Mrs. Maisel will turn him into a major star. But he isn't right now, and while you don't necessarily need big names to open a superhero movie, I do think you need at least a little star power somewhere, even if it's just in the supporting roles. Djimon Houndsou and Mark Strong have their fans but neither is a big name, and they were barely featured in the marketing, so they were banking mostly on people showing up for "that guy from Chuck" and "that kid who seems familiar... was he in Stranger Things or something like that?"
...and that brings me to...
4. A BAADDDDD marketing campaign. As others have mentioned, why didn't they promote this thing? One trailer from Comic Con and then months and months of nothing, and then a final marketing push right before the movie. Did they want it to fail? Did Zack Snyder slip Warner Brothers' marketing director a couple grand to make the movie bomb and ensure that only DARK DARK DARK DC superhero movies make money? It was just a bizarre strategy.