难怪 (nánguài) can be used to express that the speaker finds something unsurprising. It can be used alone or in a variety of different structures. 怪不得 (guàibude) is another way to express exactly the same thing, in a slightly more informal way.
难怪 as "it is not surprising that"
Here 难怪 is used to convey the speaker's lack of amazement at a situation. It is used in much the same way as 怪不得, which can replace 难怪 in the structure without altering its meaning.
难怪 / 怪不得 + ([observation])
tā hé nǚpéngyou fēnshǒule, nánguài tā zuìjìn yīzhí bù gāoxìng.
He and his girlfriend broke up. No wonder he's been so unhappy recently.
xiǎo zhāng qǐngjià le, nánguài jīntiān méiyǒu kàn dào tā.
Little Zhang asked for some vacation time, no wonder I haven't seen him today.
nǐ de shǒujī diūle? ,nánguài nǐde shǒujī yīzhī dǎbùtōng .
You cellphone is lost? No wonder I couldn't get through.
难怪 / 怪不得 + [observation]，原来 + [reason]
nánguài lǎobǎn zhème shēngqì, yuánlái nàge dà kèhù qǔxiāo le dìngdān.
No wonder the boss is so angry. It turns out that that important customer cancelled his order.
nánguài zhèlǐ rén zhème duō, yuánlái zài dǎzhé.
No wonder there are so many people here. There's a sale going on.
nánguài tā tiāntiān dōu chídào, yuánlái tā yào zìjǐ zhàogù háizi.
No wonder he's late every day. It turns out he's raising his kids by himself.
nánguài tā yīzhí dōu méi gàosù wǒ.Yuánlái shì bùxiǎng ràng wǒ dānxīn.
No wonder he hasn't told me.It turns out that he doesn't want me to worry about this.
nánguài zhème duō rén dōu xiǎng rènshi tā,yuánlái tā bà shì shìzhǎng.
No wonder so many people wan to meet her.It turned out that her father is the mayor.
难怪 as "is not to be blamed"
In this case, the meaning is totally different. Although it's not as common and you shouldn't need to worry about it too much, if you ever run into and think that 难怪 can only ever have one meaning, it can totally get you confused.
(这也 +) 难怪 + [specific person/people]
zhè yě nánguàitā, háishì gè háizi ne, shénme dōu bù dǒng.
Don't blame him. He's just a kid. He doesn't know better.
zhè yě nánguài nǐ, tā zuótiān cái gěi nǐ huífù.
Don't blame yourself. He just replied to you yesterday.
zhè yě nánguài, nǐmen dì yī cì dào zhè ge dìfāng hái bù liǎojiě zhèlǐ de fēngsú.
Don't blame yourselves. It's your first time here, and you don't understand the customs.
zhè yě nánguài, tāmen gōngzuò zhème lèi, gōngzī hái zhème dī.
Don't blame them. Their job is so tiring but they get such a low pay.
When used in this way it expresses that the speaker assigns no blame in the situation he is describing. Sometimes the specific person undeserving of blame is mentioned directly after 难怪, as in the first two examples. Often however the context makes clear who this person is, as in the last two examples.
Translated from: AllSetLearning