mid-15c., "having manners befitting a court," from court (n.) + -ly (1). Meaning "pertaining to the court" is from late 15c. Courtly love "highly conventionalized medieval chivalric love" (amour courtois) is attested from 1896.
[courtly etymology, courtly origin, 英语词源]