The Harry Potter author was revealed as the writer of crime novel The Cuckoo's Calling in the Sunday Times.
She found out the leak came from law firm Russells, whom she had assumed she "could expect total confidentiality from".
"I feel very angry that my trust turned out to be misplaced.
"To say that I am disappointed is an understatement," she said in a statement.
"A tiny number of people knew my pseudonym and it has not been pleasant to wonder for days how a woman whom I had never heard of prior to Sunday night could have found out something that many of my oldest friends did not know," she added.
Russells Solicitors said it apologised "unreservedly".
In a statement, it said the wife of one of its partners, Chris Gossage, had told her best friend, Judith Callegari, that Robert Galbraith was really Rowling.
The company said it was revealed "during a private conversation" adding "the disclosure was made in confidence to someone he trusted implicitly".
It has been reported Ms Callegari subsequently revealed Rowling's identity to a Sunday Times journalist via Twitter on 9 July.
Russells continued: "Whilst accepting [Gossage's] own culpability, the disclosure was made in confidence to someone he trusted implicitly. On becoming aware of the circumstances, we immediately notified JK Rowling's agent."
There had been speculation leaking the name was part of a publicity campaign.
However Russells said: "We can confirm that this leak was not part of any marketing plan and that neither JK Rowling, her agent nor publishers were in any way involved."
The Cuckoo's Calling - believed to be the debut novel of Galbraith - tells of war veteran-turned private investigator Cormoran Strike and received good reviews when it was first published.
It had sold 1,500 copies before Rowling was revealed as the author, but within hours it rose more than 5,000 places to top Amazon's sales list.
When she was revealed as Galbraith, Rowling said she had found writing under a pseudonym "a liberating experience".
She issued a statement saying she had "hoped to keep this secret a little longer" but added it had "been wonderful to publish without hype or expectation, and pure pleasure to get feedback under a different name".