In the seventeenth century, the British borrowed a Dutch army custom of sounding a drum and bugle to signal soldiers that it was time to stop socializing and return to their barracks for the night.
The Dutch called it “taptoe,” meaning “shut off the taps,” and the abbreviated “taps” became a signal for tavern owners to turn off the spigots on their beer and wine casks.
After lights out, taps signals that the soldiers are safely home, which is why it’s played at funerals.
The bugle call at day’s end is often called “taps”.