There are various reasons for this. In some cases the word was pronounced differently in different dialects, and the version that supplied the spelling was not the one that became the standard for speech. In some cases the pronunciation has changed over time, but the spelling has remained the same.
New words, one handy idiom, and a 2-minute quiz — delivered to your inbox to keep your streak alive.