Joanne Rowling doesn't have a middle name. Her publishers wanted her to use a gender neutral name on the cover of Harry Potter. Instead of Joanne, she went by J.K. The hope was that this would earn the book some male readers that would otherwise avoid a book written by a woman.
The K was chosen by Rowling as a tribute to her grandmother, Kathleen Ada Bulgen Rowling. The "Kathleen" part, however, is, to this day, not part of Rowling's real legal name.
(Sources: 1, 2)