While different heroes may have specific motivations for keeping their true identity secret, there are a few common themes driving the secret identity, including a desire to lead a normal life outside of crime fighting, a desire to protect one's family from danger and public scrutiny and essentially having an undercover presence that can help the hero glean information they might not get while in costume. Some superheroes, such as Superman, have an alternate identity that masks the fact that the hero persona is their "true" self, while others, such as Batman, use the superhero persona as a cover for activities they wouldn't want associated with their civilian identity.
Some superheroes, such as Reed and Sue of the Fantastic Four, have children who may be vulnerable to attack, kidnap or even child protective service investigation if their civilian identities were to become public knowledge. But there are less practical and more narratively focused motivations behind secret identities. For example, Spider-Man's attempts to conceal his identity as Peter Parker form a major plot point in several of the Spider-Man stories, both in comic books and in other adaptations. This need to keep something secret adds jeopardy and tension to a story that may otherwise just be about fighting crime.