What is the meaning of of when it starts a sentence? For example,
and what is the grammatically correct way to write a sentence starting with of?
If we take your specimen text,
The thing I'm most afraid of is me. Of not knowing what I'm going to do. Of not knowing what I'm doing right now
it is apparent that it is semantically one sentence that has been turned into one sentence plus two sentence fragments for rhetorical effect. (The main verb that makes gives meaning to the two sentence fragments is contained in the sentence that begins the sequence of statements.) It could as easily have been presented thus:
The thing I'm most afraid of is me: of not knowing what I'm going to do; of not knowing what I'm doing right now
In the second version, we can see that what follows the colon is a continuation or extension of the primary statement,
The thing I'm most afraid of is me:
of not knowing what I'm going to do; of not knowing what I'm doing right now
provide the specific justifications for saying "The thing I'm most afraid of is me".
The fragmentary presentation of the first version of the text is presumably intended to increase the impact of the justifications. It achieves this by forcing the reader to slow down at each period/full stop, and to consider each justification separately.
At the same time, it also emphasizes the rhythmic repetitiveness of the statements, with each successive statement building on and amplifying the previous one, like a drum that gets a little louder with each new beat.
Here, I would say it is being used pretty effectively.
In general prepositional phrases at the beginning of sentences are common and grammatically correct.
As for you sentence, of not knowing is the continuation of a previous sentence with afraid of. It works in the literary context provided but not really common usage in spoken language.
The word of has a common meaning, as in I'm afraid of (something or someone).
I assume that these sentences are challenging because they omit some words through the concept of ellipsis.
Most of us are familiar with the idea of you (understood). We make grammatical sense of a sentence like Go home by realizing that you is understood to be the implied subject, even though it is left out.
Ellipsis is at work everywhere in English, including in the most formal prose by the most careful of writers.
As exemplified in the article linked to above, when we say something as ordinary as
He will help, and she will, too.
We break grammar rules, among the most fundamental of which require a verb in the second clause:
He will help, and she will (help), too.
Murakami left out some parts of those sentences in your question because readers can predict or understand that those missing words are actually "there".
Therefore, we can say that the sentences don't truly begin with of, at least in this sense. We can infer that the omitted text could be restored to look something like:
The thing I'm most of afraid of is me. I'm most afraid of not knowing what I'm going to do. I'm most afraid of not knowing what I'm doing right now.
It is impossible to learn all of the ways in which ellipsis can work, and the best writers and linguists in the world will disagree over whether this or that particular instance of ellipsis is grammatical. And the effects of ellipsis on listeners or readers can range from a very strong difference in meaning or feeling to no difference whether words are elided or not.
The best thing for English learners to do is to be aware that ellipsis exists, and try to call it to mind as a possible explanation if something seems to be missing--and try to keep faith through the dark and perilous journey.
The effect of leaving out the beginning parts of the sentences in this passage is deliberate, and stylistically effective. It leaves room for the reader to co-construct meaning in collaboration with the writer to a greater degree than if all the words were there. For example, experienced readers may, more or less consciously, infer somewhat different words into what's elided. For example:
The thing I'm most of afraid of is me. At a deeper level, and more precisely, I'm most afraid of not knowing what I'm going to do. At the very deepest level, and more horrifying than anything else, I'm afraid of not knowing what I'm doing right now.