"unnecessary" means "not needed", sometimes with a hint of "and not wanted"
"not necessary" means "not required"
"Eating every day is not necessary" - Factual. You can still survive if you don't.
"Eating every day is unnecessary" - This would sound strange, since while it is not necessary, it is normal to do so.
"Rotating your car tires every week is not necessary" - Doesn't really hurt to do it but it's not needed.
"Rotating your car tires every week is unnecessary" - You really don't need to do this.
Oftentimes, there are differences, of varying magnitudes, in meaning between "unnecessary" and "not necessary". In some of these instances "unnecessary" can have a 'negative' undertone. For instance in "It was unnecessary." vs "It was not necessary." , "unnecessary" sounds slightly negative (in the sense that not only was it not required but it was also not wanted).
In other instances the difference is so slight that it might only be regional or not immediately distinguishable. In such cases it might be preferable to use other constructions over take the risk of the nuance being missed.
In other cases, such as "he can remember a lot of unnecessary details" / "he can remember a lot of not necessary details" only one version fits (due to reasons not necessarily related).