There's no hard and fast answer. In the end, the courts decide, if and when it gets to that. But really, in many jurisdictions it depends on whether a typical person might mistake one for the other. It also depends on the originality of an idea.
For example, cities under the sea are an old concept. Atlantis, Arielle, ... Spongebob wasn't the first. Similarly, American-style Diners are an existing thing, as are secret ingredients/recipes, having those in an undersea world that reflects what we have above is not really unusual either. Neither are business simulations like rollercoaster tycoon, so a restaurant under the sea isn't by itself an issue.
The problem arises when the combination is too similar to something else. Sea sponges are actual animals, but if on top of all the above your character is a yellow square-shaped thing (possibly a sponge) as well, most people would probably consider it a rip-off, even if the name was different.
But in general, the rule is that copyright applies to concrete works. Not to ideas. OTOH names are not under copyright, and are covered by trademark law.
So, a genre, even a game mechanic can not be copyrighted. That said, sometimes people try to get around this. E.g. Lego registered a lego brick as a trademark (company logos can be trademarked as well, not just names) and sued everyone who created Lego-compatible bricks, until a court finally struck that practice down, so it's better to stay away from being too similar to some existing franchise.
It's also a smart thing to do: If your game is successful, wouldn't you want people to be able to tell it from other games? IMHO that's why I would want my game to have unique names, character designs, maybe even some special game mechanic of its own. If you just imitate, it's just "one of those Sponge Bob games".
It doesn't take much. Make your own character designs. Pick different water animals, a different art style, choose different names (maybe even from a different country or culture than the original). AFAIK, anyone may make a Tetris clone. You just can't call it Tetris or the bricks Tetromino, or a name that sounds too much like it, and need a slightly different screen design.
Disclaimer: I'm not a lawyer. If you want actual legal advice, hire a lawyer.