Phonosemantic compound. 宀 represents the meaning and 取 represents the sound. Based on the original meaning "gather". The meaning later shifted to "accumulate", "many" and "most". Originally written as 㝡. Later extra strokes were added to the 宀 component.
最 and 取 don't sound similar in modern Mandarin due to historical phonetic changes. They were more similar in older Chinese.最 /*[ts]ˤot-s/ 取 /*tsʰˤoʔ/, /*tsʰoʔ/, /*[ts]ʰoʔ-s/