Both words come from the root זכר, but are in different conjugations (binyanim). לִזְכּוֹר or זָכַר is in the kal (pa'al) conjugation, and לְהִזָּכֵר or נִזְכָּר is in the nif'al conjugation.
Etymologically, זָכַר is a transitive verb meaning "to remember," and this meaning goes as far back as Biblical Hebrew. נִזְכָּר, on the other hand, means "to be remembered" in Biblical Hebrew and is intransitive. In Mishnaic Hebrew, נִזְכָּר is first used with the meaning "to remember" and usually appears as נִזְכָּר שֶׁ- meaning "to remember that...". In modern Hebrew, נִזְכָּר is usually followed by בְּ- "to remember about..." (since the word is still intransitive).
Semantically, נִזְכָּר differs from זָכַר in that it carries a connotation of realizing, i.e. remembering something that had previously been forgotten, whereas זָכַר can refer to uninterrupted remembering.
For example, one dictionary defines זָכַר as
לא שכח, השאיר במודעות (source)
didn't forget, kept in awareness
and נִזְכָּר as
חזר אל זכרונו דבר מה ששכח (source)
something he forgot returned to his memory