Cause
Your car (like most cars) saves the milage in a small memory chip inside the instrument cluster. That chip is called an EEPROM. Like most memory units EEPROMs are subject to wear.
If you rewrite the data often enough the chip will fail to save the new data or save corrupted data. This could be the case here.
So, why is the "correct" (i.e. new) value displayed? Because the value is saved somewhere else (in RAM) temporarily before it gets saved to the EEPROM for long-term storage. This temporary value does not survive your
Process of odometer display / save
Start of car: Read last value from EEPROM
Continuously: Calculate new value (by adding miles to last value). Show current value in display.
Every x seconds or miles: Save new value to EEPROM
Repair
Your can
replace the EEPROM in your instrument cluster. This is a rather complicated procedure which requires some electronics and computer knowledge.
You have to desolder the old chip, buy a new, copy data from old to new and solder the new chip in.
If you haven't done this before chances are you are breaking your instrument cluster. Besides you probably have to the buy special tools to do it.
replace your instrument cluster. This is a far more easy way of fixing the problem. Buy a used instrument cluster and swap it with your old.
The new cluster's odometer will start from a wrong milage, but it will count correctly. If you plan to sell the car you should inform the buyer of the differing milage.
In order to obtain the offset, maybe you can read the correct milage from the ECU using a OBD2 dongle or someone at a Nissan workshop can tell you using their diagnostic tool.
Bonus: EEPROM wear
EEPROMs last many erase and write cycles. The number of life-time cycles are in the 100000s or millions. That sounds much but considering a 20 year usage of a car, it is not.
If you use your car for 250k km (~150k mi) and the car saves the new value every 0,25 km thats 100000 writes.
If you drive with an average of 50 km/h (~30 mph), it takes you 5000 hours to drive 250k km.
If your car is not updating the values by distance but by time and it does that once every 10 seconds, you have 1,8 million writes.
I don't know which of the two intervals is used to update the storage, but I guess it's a combination of those two: Each x miles, but at least every y seconds.
While most chips exceed their life expectancy, some don't. This can be a result of higher operating and storing temperatures or just a random fail.