The story
It first meant “genuine,” not “well-behaved.” When paper money was new, people trusted gold far more than paper promises, so a note you could count on was “as good as gold.” A witness in a London court used those words in 1827. By 1843 Charles Dickens used it in A Christmas Carol for little Tim, and the sweeter meaning stuck.