A good place to start is doing the tutorial in SG that goes over blocking mix-ups. There's also a tutorial on pushblocking.
There's also worldjem's
guide to defense.
In fighting games, it's fine if your defense got broken. It's impossible to block everything. Just take note of how they got that first hit. Did they go high, low, or was it a grab? Did they do a cross-up or was it an overhead? Were you caught hitting buttons when they were on frame advantage?
Defense is based on character and player knowledge. For example, Double doesn't have any overhead attacks, so the only time you should block high in that match-up is when she's in the air. However, her command dash, flesh step, can run right behind you and cross you up. So her options are either a low, a throw, or a cross-up with an assist or cat heads.
Player knowledge comes to play since humans tend to do things in patterns. Once you recognize your opponents attack patterns, stop and think what you can do to prevent getting opened up. Say a Squigly player keeps spamming j.hp. Since the Squigly player stays in the air, there's no reason to block low. You should also try find an anti-air move that shuts down that type of offense.
You gain this knowledge by playing people.
tldr; in-game tutorials, worldjem has a detailed guide, and play people to recognize situations where you should block high/low/crossup