Afonso was born in Sintra, the second son of King Edward of Portugal by his wife Eleanor of Aragon. Following the death of his older brother, Infante João (1429–1433), Afonso acceded to the position of heir apparent and was made the first Prince of Portugal by his father, who sought to emulate the English Court's custom of a dynastic title that distinguished the heir apparent from the other children of the monarch. He was only six years old when he succeeded his father in 1438.