William Alexander Greenhill was the youngest of three sons of George Greenhill, treasurer of the Stationers' Company. He was educated at Rugby School under Thomas Arnold: a favourite pupil of Arnold, he later married Arnold's niece Laura Ward. At Rugby he befriended A. H. Clough, W. C. Lake, A. P. Stanley and C. J. Vaughan; he went on to Trinity College, Oxford, where he took no arts degree but (studying medicine at the Radcliffe Infirmary and Paris) graduated M.B. in 1839 and M.D. in 1840.
Greenhill was appointed physician to the Radcliffe Infirmary in 1839. A "pioneer in the cause of sanitary reform, in the days when sanitary reform was thought a crazy fanaticism", he first wrote on Oxford's public health and mortality for the Ashmolean Society, after a cholera outbreak in Oxford.
In 1840 he hosted Richard Francis Burton in his house, encouraging the young student to study the Arabic by introducing him to the Spanish scholar Don Pascual de Gayangos. At the time Greenhill, who lived in John Henry Newman's parish, was serving as Newman's churchwarden; he came to know Pusey, and other leaders of the Oxford Movement. Other Oxford academic friends included Charles Page Eden, William John Copeland, Charles Marriott, J. B. Morris and James Bowling Mozley. A political liberal, Greenhill actively supported William Ewart Gladstone's election as MP for the university in 1847. Like other university liberals, however, he was later discomfited by Gladstone's direction in the 1880s: he did not vote liberal in 1885 (fearing disestablishment of the Church of England) or 1886 (objecting to the Home Rule programme.)
In 1851 Greenhill resigned his Radcliffe Infirmary post and briefly attempted practice as an Oxford physician. However, he moved later that year to Hastings on grounds of health, though he may also have wanted to escape Oxford's febrile religious controversies. For many years he was physician to the St. Leonards and East Sussex Infirmary. His investigations of mortality rates in Hastings showed the insanitary conditions of artisan housing, despite the town's new popularity as a health resort. In 1857 he founded the Hastings Cottage Improvement Society, and was its secretary from 1857 to 1891: this company bought up and improved insanitary accommodation, as well as building new housing of a better standard. The venture's success prompted Greenhill to promote the idea at the National Association for the Promotion of Social Science, and establish a similar organisation in London, the London Labourers' Dwellings Society, of which he was secretary from 1862 to 1876. On Gladstone's recommendation, Greenhill was granted a civil list pension of £60 in 1881. At the time of his death at The Croft, Hastings, aged 81, Greenhill had outlived his wife and his eldest daughter and son, who had each died young; one son and one daughter survived him.
Greenhill's interest in Arabic and Greek medical writers resulted in a Greek and Latin edition of Theophilus, a Latin edition of Thomas Sydenham (1844), an English translation from the Arabic of Rhazes on small-pox, and a large number of articles in William Smith's Dictionary of Greek and Roman Antiquities. In the mid-1840s he published anonymous memoirs of James Stonhouse, Thomas Harrison Burder and George Cheyne, and edited material on physicians' social duties by Jacob Horst, Christoph Wilhelm Hufeland, and Thomas Gisbourne. Greenhill was an enthusiast for Sir Thomas Browne, and his 1881 edition of Religio Medici for Macmillan's 'Golden Treasury' series was praised for its scholarship, becoming a standard edition of the book. His edition of Browne's Hydriotaphia and Garden of Cyrus, unfinished at his death, was completed by his friend E. H. Marshall and published in 1896. He was an editor and frequent contributor to the British Medical Journal, and contributed to Notes and Queries and the Dictionary of National Biography.
- (ed.) Θεοφιλου ... Περι της τους ἀνθρωπου κατασκευης βιβλια Εʹ. Theophili ... De corporis humani fabrica libri V, Oxford, 1842. Latin and Greek
- (tr. from Latin of Jacob Horst) Prayers for the Medical Profession, London, 1842
- (anon.) Advice to a Medical Student, London, 1843
- (ed.) Thomae Sydenham opera omnia, Sydenham Society, 2 vols, 1844, 1846. English & Latin
- (anon., preface signed 'α') Life of the Rev. Sir James Stonhouse, Bart., with extracts from his tracts and correspondence, Oxford: J. H. Parker, 1844
- Anecdota Syndenhamia: medical notes and observations of Thomas Sydenham, M.D., hitherto unpublished, 1845
- (anon., preface signed 'α') Life of Thomas Harrison Burder, M.D., with extracts from his correspondence, London: Rivingtons, 1845
- (anon.) Life of George Cheyne, M.D., with extracts from his works and correspondence, Oxford: John Henry Parker, 1846
- (ed.) On the relations of the physician to the sick, to the public and to his colleagues, Oxford, 1846. (Extracts from C. W. Hufeland's Enchiridion medicum)
- (tr. from Arabic of Rhazes) A treatise on the small-pox and measles, 1847
- Medical report of the case of Miss H. M., 1847
- (ed.) On the duties of physicians, resulting from their profession, Oxford, 1847. (Ch. 12 of Thomas Gisborne's Enquiry into the duties of men in the higher and middle classes of society in Great Britain)
- Monthly (Quarterly, Annual) report on the mortality and public health of Oxford. Ashmolean Society, 1849–50.
- On the establishment and management of cottage-improvement societies: a paper read in the fifth department of the National Association for the Promotion of Social Science, in the Guildhall, London, 9 June 1862, London, 1862
- Adversaria medico-philologica, London, Savill and Edwards, 13 parts, 1864–1872. Reprinted from the British and Foreign Medico-Chirurgical Review.
- ‘A Classified List of the Charitable Institutions of Hastings and St. Leonards, Hastings, 1873
- A form of prayer to be used on the opening of a new house or block of buildings, London, 1873
- On the Mortality and Public Health of Hastings. Paper read at the Health Congress, Hastings, May 1889, Hastings: F. J. Parsons, 1890
- The Contrast: Duty and Pleasure, Right and Wrong, Hastings, 1874; 6th edit., London, 1893
- (ed.) Sir Thomas Browne's Religio medici, Letter to a Friend, &c., and Christian morals, Macmillan, 1881
- (ed. with E. H. Marshall) Sir Thomas Browne's Hydrotaphia and the Garden of Cyrus, Macmillan, 1895
- Perry Butler (2004) ‘Greenhill, William Alexander (1814–1894)’, Oxford Dictionary of National Biography, Oxford University Press.
- Obituary, BMJ, quoting the judgement of an old friend in the Hastings News
- Acland, Memoir upon the Cholera at Oxford in 1854
- J. S. Cotton (2004) 'Burton, Sir Richard Francis', Oxford Dictionary of National Biography, Oxford University Press.
- W. W., 'Obituary. William Alexander Greenhill', The Classical Review 8:9 (Nov. 1894), pp. 423–4
- Burgon, Twelve Good Men, II.110
- ODNB, citing B. B. W. Richardson, 'Memoirs', The Asclepiad, 2nd ser., 11 (1894), 165–89
- "William Alexander Greenhill, M.D". British Medical Journal. 2 (1761): 734. 1894. doi:10.1136/bmj.2.1761.734. PMC 2405076.