Why does this happen

So, I’m so confused as to why some characters have different pronunciations despite being the same, like 觉得/睡觉 and 快乐/音乐. Is it a dialect thing, or…?

So, I’m so confused as to why some characters have different pronunciations despite being the same, like 觉得/睡觉 and 快乐/音乐. Is it a dialect thing, or…?