J.K. Rowling added the middle initial K to her pen name before publishing Harry Potter.
Rowling was born Joanne Rowling in Yate, Gloucestershire, in 1965. She did not originally have a middle name. Bloomsbury, her British publisher, reportedly wanted a name that might appeal to boys as well as girls, so Rowling adopted initials rather than publishing as Joanne Rowling.
The K stands for Kathleen, the name of Rowling’s paternal grandmother. Rowling has said that Kathleen was not her own legal middle name; it was selected for the pen name. The author is therefore commonly styled J.K. Rowling, although the initials do not represent two original given names.
A related point is that Rowling later used Robert Galbraith as a pseudonym for her crime novels. J.K. Rowling remains the name most closely associated with the Harry Potter series.