The expression developed from the noun hang, meaning the characteristic way something works or is handled. That noun is related to the verb hang, from Old English hangian and hōn, and the idiomatic sense of practical knack is recorded in English from the nineteenth century.