We start with Latin, where there was the word "memorō", the infinitive form being "memorāre". The first change to note is in the prosody: as we move from Classical Latin to Late Latin/Proto-Romance and subsequently to Western Romance, the stress pattern shifted from vowel length to intensity—broadly speaking, this meant that the phonological distinction between short and long vowels in Latin disappeared, giving way to a system where stressed syllables are emphasized at the expense of unstressed syllables, causing the elision of unstressed vowels, resulting in "memrar" at this stage.
Here, a systematic phonological change takes place, not only in Portuguese but essentially throughout the entire Romance linguistic area, where the consonant clusters /mr/ become /mbr/, since, for the lack of a better term, these clusters are difficult to pronounce, resulting in the form “membrar”; this same phenomenon occurs in the word "ombro", which comes from the Latin "umerus" with elision of the second vowel.
In many Romance languages, this is the form that has been preserved, and it's ultimately the origin of the “member” in the English word "remember" (from Old French "membre"); in Portuguese, however, this was not the form that came to be in the contemporary language.
What follows is a dissimilation of the initial /m/s: the first /m/ becomes an /n/, giving us the form "nembrar", already attested in medieval Galician-Portuguese.
What happens then is a very simple change, however a remarkably rare one that isn't systematic at all in Portuguese, where the initial /n/ turns into an /l/. The how is very simple, /n/ and /l/ share (or at least used to at this stage of the language) the exact same point of articulation, making the sound change conceptually plausible. Now the why is less clear; my assumption at first was another dissimilation process, but looking at the very few words that went through this sound change or one parallel to it (particularly, *naranja --> laranja and leixar --> deixar), there seems to be no substantial difference between either the point or the manner of articulation between each stage, and as far as i know there really isn't a lot of literature specifically about this peculiar shift, let alone hypotheses behind it, so jury's still out on that one. Either way, we reach the the modern form, lembrar.
The reason for why I love this evolution is that, although the modern word is unrecognizable from the Latin root whence it originated, to such an extent that I doubt any speaker of modern Portuguese would be able to associate lembrar with its neoclassical doublet memorar (or a more commonly used derivation, memorizar) — to the point that even I, who has a background in linguistics, failed to recognize this connection for a very, very long time — the meaning has remained exactly the same throughout over 2000 years of constant evolution: the Latin memorō meant “to remember,” so does the current word. Not that this is absurdly uncommon, but in my experience, when it does happen, either the modern form remains visibly derived from the Latin root, or the modern form is so, so obscure that, despite still appearing in dictionaries or historical corpora, in practice it is no longer part of the language’s lexicon. But with “lembrar,” we have a verb that’s unique in that not only has there been very little semantic shift, but it would also be difficult to arrive at the Latin root by simply applying systematic sound changes, all while being one of the most widely used verbs in the Portuguese language across basically all its varieties, and I think that’s really cool.