Prince Frederick William, the Duke of Brunswick (9 October 1771 – 16 June 1815),
His father was a Field Marshal in the Prussian Army who had served with distinction in the Seven Years War.
Prince Frederick's military career started as a captain in the Prussian Service in the Revolutionary Wars. In 1806, he was a Major General and fought at Jena-Auerstadt.
With his father's death, he became the reigning Duke of Brunswick. He was deposed by Napoleon and lived on the continent in exile.
In 1809 he raised Brunswick forces which fought against France. These forces were evacuated by the British and reorganized as the infantry regiment and Hussars which served in the British Army until 1814 and 1816 respectively.
He was made a British Lieutenant General with temporary rank 1 July 1809. His high seniority could most likely be one of the reasons that kept him out of the Peninsular War.
He was a nephew of King George III and both a cousin and a brother-in-law of the Prince of Wales. So likely his candidacy was thought to be a compliment to the British Royal family. The Portuguese had a history of offering positions in their army, including commanders-in-chief, to foreign officers, a number from the German States.