"British author" is being used as an adjectival phrase in
by British author J.K. Rowling.
If you leave it out you are left with
by J.K. Rowling
which also doesn't require an article.
If you insert the definite article, as in
by the J.K. Rowling
you would change the meaning to be more like "by the one and only J.K. Rowling". If you mean something else, like "by the very talented J.K. Rowling", you would need to say so.
If you insert both "the" and the adjectival phrase, as in
by the British author J.K. Rowling
you change the adjectival phrase into a noun phrase ("British author") and create an ellipsis for
the British author [whose name is] J.K. Rowling.
This would not significantly change the meaning of the original.
If you insert an indefinite article, as in
a British author J.K. Rowling
you are probably trying to say "a British author by the name of J.K. Rowling", as if she were an unknown author. This may have been true once but is no longer true today.
Usage for the character Harry Potter is more flexible.
the life of young wizard Harry Potter
the life of a young wizard, Harry Potter
the life of the young wizard [in the story] Harry Potter
essentially mean the same thing, but "young wizard" is an adjectival phrase in the first example only, and a noun phrase in the second two. The definite article requires some context in the third example, with "in the story" generally assumed.