Walnut once identified a foreign nut, beside the familiar hazelnut.
Old English wealhhnutu joins foreigner and nut, giving the sense foreign nut. The label distinguished walnuts from familiar hazelnuts. Through Middle English walnot, the compound became much less obvious in walnut.
Source
Merriam-Webster: walnutWord History supplies the components and spellings; Kids Word Origin explains the hazelnut contrast and Welsh connection.