When the firstborn Egyptians died during Makkas Bechoros, the Plague of the Firstborn, Yahweh spared the Hebrew firstborn from a similar fate. At that time, the firstborn were consecrated, and chosen by Yahweh to be Kohanim – to perform the sacred service in the Bais Hamikdosh.
But the firstborn lost their status when they sinned with the cheit ha’egel- the Sin of the Golden Calf. The Kehuna was given to the children of Aharon. But the firstborn males had been chosen by Yahweh. They could not simply behave as if they had never been chosen. That is why they must be redeemed with a Pidyon Haben.