It’s a very critical component to have in our bodies. Up until very recently, salt was pretty hard to find, hence the strong desire is your body’s way of saying “hey I really need some NaCl, please go find it…”
It’s the same as fatty foods, chocolate, etc. Our bodies recognize them as being rare valuable dense energy sources, so when we see them, we are conditioned to eat eat eat, as our bodies still think act as if food is rare and thus whenever we encounter such things we should stockpile (storing the energy as fat).
Our bodies are simply not made for this modern world where “food” (food like products really) can be bought in so many ways. Back in the past, you would never eat all of the components inside one processed McDonald’s meal in one sitting, let alone one lifetime. And I’m not just picking on McDicks here, TONS of “food” today is processed beyond belief, containing far more than it really should. People consume so much sodium nowadays because people eat so much processed foods where it is added. It’s the same as high fructose corn syrup – it’s not that it itself is bad for you (a molecule is a molecule), it’s that it’s EVERYWHERE, it’s in so many products, and it adds up especially when people are eating more food in general.