The system/setting matters here.
CoC is horror, so the PCs for the most part have no idea what they are up against, especially early game. They would have no reason to research the monsters ahead of time, as they wouldn't even know the occult existed beforehand, and even if they were followers of the occult, chances are the myths they "know" about are all wrong (not true Cthulhu mythos). This makes a lot of strategies used in other settings, like researching what you are up against, more difficult, especially at first. Deaths in new parties are common.
I think a session 0 is in order here
Let your PCs know the expectations of the game. This is a survival horror game. As such, combat is not the primary goal. Players should react as normal people would in these situations, which normally involves running away when terrifying things show up, then researching them latter maybe. Solving puzzles and figure out how to survive and what is going on is the main goal. Combat will happen, and there are times when it's appropriate to fight, but even in the CoC core book it says fighting should not be the PCs' first option.
Maybe you can set up a starting adventure where death is not permanent
At least not starting out. I am in a CoC game right now, only 3 or 4 sessions in, and a PC died. We escaped the town full of fish people and humans with guns, only to find the train we got on is in a time loop and heading back to the same town. The PC that "died" is back alive on the train, but has lost some stats. This makes death something you still want to avoid, but it also means one lucky roll from a monster or NPC doesn't mean needing to reroll. I was honestly not expecting that, and I thought it was a nice twist.
Have players have backup character concepts handy
CoC is a more lethal game by its very nature. Unlike D&D, where magic healing and raise dead are common, death is often permanent and people are fragile (and it doesn't even take a monster, the PC in my game was killed with a single rifle bullet). Let PCs know in the session 0 that death is a very real possibility and to have multiple character ideas ready in case you need to reroll.
Let the PCs do things to even the odds
Another thing I noticed in my current CoC game is when we do fight, we have done things that made the fighting more advantageous to us. One of the first places we ended up was trapped on an island after a ship wreck with a lighthouse. We had split the party as some of the party was trying to fix the lighthouse/radio while the other half went to sheds around back to look for wood to board up a broken window. The group outside had fish people run at them (this was after we knew about their existence as we saw bodies earlier). We did the reasonable thing and ran. We didn't realize they had ranged spikes and they ran after us and fired. We decided that firing back at them over our shoulder as suppressing fire might make it harder for them to run us down. Our GM rewarded that action and allowed us to get to the lighthouse first after some rolls. We boarded the door, ran up to the room the other investigators were in, and used a workbench to block the stairs. We all waited for the fish people to try and get up through the desk, and we all 4 fired at them. All 4 of them died and we didn't take any damage. This is an example of using our environment to help us against foes that would have been much scarier if they were allowed to melee us. Encourage this. Allow your PCs to use their environment to make it harder for them. Explain that this is a thing you expect in your session 0. A well cordinated defense/attack is much more likely to work than just charging in guns blazing.
In other systems
My answer has been primarily about CoC, as that is what you are playing in and so I tailored my answer to that, but some general rules for most systems are: Research what you are up against when you can (this is sometimes possible even in CoC), prepare for likely encounters, use the environment to your advantage when possible (and flee if the environment is giving the monster's an advantage; its better to fight on your terms), always have a backup/escape plan if something goes wrong (teleportation effects, just run, use suppressive fire, magic to block the mosnters from getting to you like wall of stone or wall of force, etc.). If you do need to run, use what you learned about the monster to fight better/smarter next time, or avoid the monster until you are more powerful (this is more applicable to other systems, as CoC advancement is slow and often not much advances your combat capabilities, but in something like D&D, this might be a fair option), elect outside help if necessary (hirelings, maybe let a town know that the dragon is heading their way and you were unable to fight it off alone, but if you marshall the town's forces to help you, you are more likely to defeat it, etc.). In my experience in most TTRPGs, is creativity is to be rewarded. In other systems, like D&D, it is less expected to be put against monsters you cannot or are unlikely to be able to beat. If this is going to be a common thing, it should be mentioned in session 0.
As others have explained here, give hints that the monster is above the PCs capabilities in a straight up fight. Have it kill NPCs in one hit, have an NPC blast it with a shotgun and it barely be phased. Set it up as something the PCs should avoid. If the PCs still try to fight it, give one last warning. Have it do something that shows how easily it could kill the PCs without actually kill them. If they still insist on a fight after all the hints, that's on the PCs. Don't pull punches. Death is a learning experience. As others have pointed out, you can even explain in session 0 that you will be giving hints if a monster is too powerful, and that players should look out for those hints. Explain if hints are ignored, player death is a likely outcome. You should also encourage roleplaying. As I said earlier, its probably not most people's first reaction to seeing an eldritch horror to try and fight it. This is again something that a session 0 can help with. Let your PCs know they are expected to roleplay their characters as real 1920s people (mechanics, archeologists, scientists, reporters, etc.) and that those people's first instincts would likely not be to try and fight the huge scary monster. My character served in the great war before the campaign started and was a private investigator, so he was used to fighting. Even his first reaction was to run seeing fish people, and they are some of the tamer monsters in the setting.