It wasn't already in the public domain?
It's complicated.
In 1893, Patty and Mildred Hill wrote a kindergarten song called "Good Morning To All." You may recognize the tune:
Well. A couple decades later, the "Happy Birthday to You" version came out. There was a bit of friction between the Hills and the folks who published the HBtY version. It never really came to anything, though some sources erroneously state that royalties were being paid to the Hill sisters' estate, instead of their actual payees: Warner Music. (Who's fucking surprised?)
From Wikipedia:
None of the early appearances of the "Happy Birthday to You" lyrics included credits or copyright notices. The Summy Company registered a copyright in 1935, crediting authors Preston Ware Orem and Mrs. R. R. Forman. In 1988, Warner/Chappell Music purchased the company owning the copyright for US$25 million, with the value of "Happy Birthday" estimated at US$5 million.[10][11] Based on the 1935 copyright registration, Warner claimed that the United States copyright will not expire until 2030, and that unauthorized public performances of the song are technically illegal unless royalties are paid to Warner. In one specific instance in February 2010, these royalties were said to amount to US$700.[12] By one estimate, the song is the highest earning single song in history, with estimated earnings since its creation of US$50 million.[13][14] In the European Union, the copyright of the song was set to expire no later than December 31, 2016.[15]
The American copyright status of "Happy Birthday to You" began to draw more attention with the passage of the Sonny Bono Copyright Term Extension Act in 1998. When the U.S. Supreme Court upheld the Act in Eldred v. Ashcroft in 2003, Associate Justice Stephen Breyer specifically mentioned "Happy Birthday to You" in his dissenting opinion.[16] American law professor Robert Brauneis, who extensively researched the song, concluded in 2010 that "It is almost certainly no longer under copyright."[17] In 2013, based in large part on Brauneis's research, Good Morning to You Productions, a company producing a documentary about "Good Morning to All", sued Warner/Chappell for falsely claiming copyright to the song.[5][10] In September 2015, a federal judge declared that the Warner/Chappell copyright claim was invalid, ruling that the copyright registration only applied to a specific piano arrangement of the song, and not to its lyrics and melody.