A compliment about clothing has an older connection with strength.
Middle Dutch dapper could describe strength. English borrowed the word with a sense of neat appearance. Around 1600, a lively or nimble sense is also recorded. The fashionable meaning remained in use.
These are selected senses, not exclusive periods. The precise explanation for the first shift is uncertain. Middle Low German is also cited as a possible donor.