1928, from good (adj.) + time. Expression to have a good time "enjoy oneself" attested from 1822; earlier have a good time of it (1771). To make good time "go fast" is from 1838.
Time deducted from a prison term for good behavior: a period of solitary confinement and a loss of ''good time'' (1870+ Prison)