Being portuguese myself, I can answer from memory what we've learned from history lessons and popular knowledge.
Living on a maritime-driven country, the Portuguese people always consumed large amounts of fish. Bear in mind most coastal fishing is restrained to smaller-sized specimens - the large specimens were more expensive; and to catch big fish, you need to travel further away from the coast. If you travel very far, you need to preserve the fish during the return voyage. Salting was the most common method at the time to preserve fish.
Cod was special in two key points:
- It was a big fish that could be caught in large numbers. Up until almost the end of the 20th century cod was plentiful and there were large cod fisheries in the northern atlantic. Thus, cod was a fish that could feed a lot of people and was easily affordable.
- Salted cod is tastier than other salted fish species that can be caught in the same area. The Portuguese dried and salted numerous other species before turning to cod as their main focus. The discovery of large cod fishery areas near Newfoundland in the 15th century was the main turning point. It became the main fishing area of Portuguese fishermen in the centuries to come.
With time, eating cod became part of the Portuguese way of life. There are hundreds - maybe even thousands - of different ways to prepare salted codfish in Portugal. Most Portuguese people get used to eating it since a very early age. It's the traditional Christmas eve main dish in most of the portuguese territory, for instance. Portuguese people take it as far as considering a cultural statement - part of being Portuguese is liking and eating codfish regularly.
With the 20th century new international laws came and most Portuguese fishermen were driven out of the traditional fishing areas, Portugal nowadays depending mostly on Norwegian and Icelandic codfish to meet the demands. Cod became a luxury dish on the turn of the 21st century, being somewhat expensive now (but not prohibitive). Also, most cod fishing areas became depleted due to overfishing and bad practices, thus also driving the prices up. It's still part of the Portuguese cultural legacy, though.