It was the policy of Cornhill Magazine to publish all articles and serializations without a byline, so Hardy surely had no choice in the matter. If you look at volume 29 (January–June 1874), you’ll see that in the same year the magazine included not only Far from the Madding Crowd, but also Young Brown: or, the Law of Inheritance (by Eustace Clare Grenville Murray), Zelda’s Fortune (by Robert Edward Francillon) and many other stories and articles, all anonymous.
First page of Far from the Madding Crowd in the Cornhill Magazine for January 1874.
Few magazines of the mid-19th century printed bylines, and even today, some serial publications, such as The Economist, continue to publish the majority of their content anonymously, arguing that “what is written is more important than who writes it”.
Hardy’s first two published novels, Desperate Remedies (1871) and Under the Greenwood Tree (1872), also appeared anonymously. But these were published in book form by Tinsley Brothers, so had he wished to do so, Hardy could have published them under his own name. Why did he publish these novels anonymously?
The motivations for publishing anonymously have varied widely with circumstances, but they have included an aristocratic or a gendered reticence, religious self-effacement, anxiety over public exposure, fear of
prosecution, hope of an unprejudiced reception, and the desire to deceive. […]
Authors also chose anonymity if they felt that their authorial persona conflicted with their daily one. Sir Walter Scott signed his poetry, but he did not sign Waverley, or so he wrote in a letter, because he felt the dignity of an officer of the court in Edinburgh would be compromised if he were publicly known to be an author of popular fiction.
Robert J. Griffin (1999), "Anonymity and Authorship", New Literary History 30:4, pp. 877–895.
This concern of Scott’s seems to have been Hardy’s too. At the time of the publication of Desperate Remedies in 1871, he doubted whether he would be able to earn a living through writing, and in the likely event of his having to return to full-time practice of architecture, he feared the burden of literary notoriety:
Hardy’s wilful purpose in his early novels until Far from the Madding Crowd appeared [was] to mystify the reader as to their locality, origin, and authorship by various interchanges and inventions, probably owing at first to his doubt if he would pursue the craft, and his sense of the shadow that would fall on an architect who had failed as a novelist.
Florence Emily Hardy (1933), The Life of Thomas Hardy: Compiled Largely from Contemporary Notes, Letters, Diaries, and Biographical Memoranda, as Well as from Oral Information in Conversations Extending Over Many Years, p. 74.
If Hardy did choose anonymity because of a worry about the potential cost to his reputation, then this was a prudent choice, for a review in The Spectator opened with a savage attack on the novel and on the author for having “prostituted [his powers] to the purposes of idle prying into the ways of wickedness”:
This is an absolutely anonymous story; no falling back on previous works which might give a clue to the authorship, and no assumption of a nom de plume which might, at some future time, disgrace the family name, and still more, the Christian name, of a repentant and remorseful novelist,—and very right too. By all means let him bury the secret in the profoundest depths of his own heart, out of reach, if possible, of his own consciousness. The law is hardly just which prevents Tinsley Brothers [the publishers] from concealing their participation also.
Anonymous, The Spectator, 22nd April 1871, pp. 481–3.