John Grigg was born in London, England, on 4 June 1838, the son of James Grigg, chief clerk and financial manager of a home-furnishing business, and his wife, Ruth Jones (formerly Martin). Both parents died during his teenage years. Grigg received a good education, including a grounding in mathematics and science. He also belonged to choral societies, played the violin and a variety of wind instruments, and qualified as a music teacher.
John Grigg married Emma Mitchell in London on 13 September 1858, and in 1863 they emigrated to the Albertland settlement at Kaipara, New Zealand. Emma died there on 1 February 1867, leaving four young children; a daughter had died in infancy. In 1868 Grigg moved to Thames with his two eldest sons; the younger boys remained in Auckland. Grigg established a furnishing and upholstery business in Thames and later added a music shop, and taught singing to schoolchildren at district schools. He established the Thames Choral Society and became its conductor. He also composed religious and popular music; one of his songs, 'My own New Zealand home', for a time achieved prominence as an unofficial national anthem.
On 9 May 1871 at Thames Grigg married Sarah Ann Allaway; the two younger boys then joined their father. The couple had one son before Sarah died during a miscarriage on 8 July 1874. Grigg's third marriage was to Mary Jane Henderson, at Auckland on 6 July 1887; they had two daughters and two sons. A devout Baptist, he was foundation member, deacon, organist and choirmaster of the Thames Baptist Church.
During his teenage years Grigg had developed a fascination for astronomy after visits to the Royal Observatory, Greenwich, and this was revived by the 1874 and 1882 transits of Venus across the face of the sun. Thereafter this hobby became a major preoccupation, to the extent that he retired early, aged 56, in order to devote more time to it.
By 1882 Grigg owned a 3½-inch refracting telescope, and in 1884 he constructed an observatory for it in his backyard. In 1894 he transferred the observatory to a new site and re-erected it as part of a much larger two-storeyed structure, incorporating a downstairs office and workshop. The observatory included a transit telescope, which Grigg used to maintain a time service for the citizens of Thames. He also possessed considerable mechanical genius, and applied this to his astronomy. He used batteries to light the telescope and his observatory, which he linked to his house with a home-made telephone.
Grigg's first serious astronomical observations were of the 1882 transit of Venus. He later observed transits of Mercury, solar and lunar eclipses, occultations of stars by the Moon, and sunspots. In 1911 he declined an invitation to an expedition to Vava'u, Tonga, to observe a total eclipse of the sun.
Grigg's real forte was the search for new comets. Between 1886 and 1910 he observed a number of different known comets, and published some of his observations in overseas astronomical journals. He began systematic comet seeking in 1887, but it was not until 22 July 1902 that he made his first discovery. This object is now known as Comet 1902 II P/Grigg–Skjellerup, and has one of the shortest periods of any known comet. Grigg found his second comet on 17 April 1903, and his third comet (now known as Comet 1907 II Grigg–Mellish) on 8 April 1907. He also independently discovered a comet in 1906, only to learn soon afterwards that it had been detected at an earlier date by an Australian amateur astronomer. Grigg retired from comet watching about 1912. In recognition of his first two discoveries he was awarded two Donohoe medals by the Astronomical Society of the Pacific.
Another of Grigg's notable achievements was in the application of photography to astronomy. Between 1890 and 1910 he used home-made cameras attached to his telescope to record sunspots, the Moon, a solar eclipse and two comets. His cometary photographs were particularly impressive, and he stands out as one of New Zealand's earliest astrophotographers.
In addition to his observational programmes, Grigg was committed to popularising astronomy. He conducted public viewing nights at his observatory, lectured on astronomy, and contributed a regular column, 'Astronomical notes', to the Otago Witness. Grigg joined the British Astronomical Association in 1897, and in 1906 he was elected a fellow of the Royal Astronomical Society. He published in the journals of both societies.
John Grigg died in Thames on 20 June 1920 after a long and fruitful life. He was survived by his third wife, six sons and a daughter.