Apart from a low fertility rate, why is the Portuguese population declining?
As you write, fertility rate explains most of it, and immigration explains the rest.
People tend to migrate to richer countries, and Portugal is below average EU income. (Portugal is an EU member. The EU has freedom of movement, the citizens of any member state can relocate to other member states and work there.) Real per capita GDP is 30% less than in its neighbor Spain, and almost 50% less than in Germany.
This P3 website from September 9 2015 lists 10 points in Portuguese, mostly on brain drain. In English —
Qualified emigration has grown 87.5% between 2001 and 2011, even though only 11% of the emigrants have a college degree).
The Eurozone sovereign debt crisis was the great trigger: 4/5 of the individuals in the sample have left the country after 2008.
Qualified emigrants are mostly young people (89.6%) and holders of post-graduate degrees (74.5%).
About a third of the sample is made of people with training in STEM fields.
Qualified emigration transfers workers to the central countries: UK, Germany, France, ...
These flows have an effect on employment: 36.1% of them were unemployed in Portugal, vs 3.8% in the destination country.
Earnings increase significantly: over 70% had a salary below 1000€ in Portugal, while over half the individuals has a salary above 2000€ in the destination country.
For 95.4%, the principal reason to emigrate is fulfilling career where they feel realized professionally.
Most of the inquired see themselves as emigrants "for life" on the current country or in other European countries (61.7% and 68.9%).
According to the model used by the team, the cost to Portugal of this brain drain is 10,312,500,000€.
An alternative answer, which is based on the (certainly valid) answer from Giskard: People from "poorer" countries tend to migrate to richer countries, because they often equate wealth with happiness. Both terms might be connected in a way but they are definitely not the same.
In Germany, we have a lot of migrants from all over the world. It is a growing topic in society and politics, that these migrants are often unhappy here and do not settle in a long run. The more their original culture differs from ours, the less the chance they will be happy and integrate. Maybe now they have more money than before but what they lost is their true wealth: Their cultural daily life, home, in most cases their friends and relatives and many more things. As a result, migrants who do not integrate hit the economy very hard.
So my answer to your question is: Migration often takes place because of false conceptions of how life would be and what brings happiness.