As near as anyone can determine, they were first composed for the bells of the Church of St. Mary the Great, which is the University church for the University of Cambridge. Nobody knows who, precisely, composed it, but the person most associated with it is the composer William Crotch, who seems to be the person who recommended the tune to the authorities. However, the chimes became world-famous when they were selected for the clock tower at the Palace of Westminster (whose largest bell, used to strike the hour, is itself world-renowned under the name 'Big Ben'). Thence it became the most common clock chime in the world.
Apparently the tune has common lyrics associated with it, although with lots of variations:
All through this hour,
Lord, be my guide,
And by Thy power
No foot shall slide.