Who discovered Portugal and when?

Nobody "discovered" Portugal.
Portugal became a single political entity in the late 11th century and throughout the 12th century gained consciousness of political independence from any kind of vassalage, except of the Pope's protection.