The middle initial in J.K. Rowling’s published name is K. Rowling’s birth name is Joanne Rowling, and she did not originally have a middle name represented by K.
Her publisher asked her to use initials because research suggested that some boys might be less likely to choose a book by a woman author. Rowling selected K in honor of her paternal grandmother, Kathleen Ada Bulgen Rowling. The resulting name, J. K. Rowling, was used for the Harry Potter novels.
The arrangement sometimes leads readers to assume that Rowling’s full legal name is Joanne Kathleen Rowling. The K is associated with Kathleen, but published biographies identify her birth name as Joanne Rowling. She has also been known as Jo Rowling.
For her crime fiction, Rowling used the pseudonym Robert Galbraith rather than J.K. Rowling. Her adult novel The Casual Vacancy, published in 2012, was released under the J.K. Rowling name.