A knight in shining armor is a heroic, idealized male who typically comes to the rescue of a female in a difficult situation. The phrase is sometimes used in more cynical works to indicate a wide-eyed idealist.
The phrase originated in the days of Old England, when popular imagination conjures up images of chivalry and of gallant knights saving fair maidens in distress. The reality behind that imagery is doubtful and no doubt owes much to Victorian novelists and painters who were captivated by the chivalrous ideal of the fictional court of Camelot. Nevertheless, knights did wear armor and that worn by royalty and the high nobility was highly polished and therefore shiny.
The earliest reference appears to date from the late 18th century, in The British journal The Monthly Review, 1790, in a poem called Amusement: A Poetical Essay, by Henry Pye:
No more the knight, in shining armour dress’d
Opposes to the pointed lance his breast
A cultural trope in Europe since medieval times, most good knights practice chivalry, honor, and self-control, and occasionally chastity. They are prone to rescuing the damsel in distress from dragons or fates worse than death, or delivering her from false accusations, often whilst bearing her favor. The Knight in Shining Armor was frequently portrayed as falling in love with a princess merely on hearing her described, without even seeing her, though his love and heroism usually won her heart. All this can apply to present-day heroes, but modern ‘knights in shining armor’ may dress as they please.
Historical knights were first and foremost professional soldiers. They usually were of the aristocracy. Their modus operandi was lance-armed heavy cavalry, which charged the enemy in full gallop. They often were used dismounted as well, when they fought as heavy infantry, usually armed with poleaxes or two-handed swords. An “officer and a gentleman” is the modern version of this trope.
“Knights in shining armor” probably have it little easier these days. Jeans, tees, and baseball caps need no polishing.