The story
Castle came into English twice. Late Old English borrowed castel from Late Latin castellum — a diminutive of castrum, "camp, fort" — with the meaning "village" or "town". After the Norman Conquest, the Old Northern French castel brought the meaning we know: a fortified building. Both had a pronounced T: something like KAS-tel.
Around the 17th century, English speakers simplified the sound combination s-t-l at the end of a word. When the last syllable shrank to a syllabic L — the "ul" sound — the T in between was dropped. The same change made the T silent in listen, whistle, thistle and fasten.
By then the spelling castle was settled, so the T stayed on the page. Other languages show the T that English lost: Spanish castillo, Italian castello, Catalan castell.
