why sometimes "po" and others "w" for "in"
It's mostly 'w', but also sometimes (for the times of day) it is represented by an adverb... and Polish for "in the afternoon" is actually just literally "after noon".
"I am writing a book today in the afternoon" sounds unnatural in English. "I am writing a book this afternoon" would be more normal.
Well, maybe it's not perfect, but we want to keep the translation of 'dziś' in the default answer. "this afternoon" is accepted as well.
why is "Dziś po południu, ja piszę książkę" not an acceptable answer?
"Ja" here is so redundant, that it really makes the sentence look weird. It's as if you needed to stress that it is you who is writing a book and not someone else.
What is the difference between "Dziś" and "Dzisiaj"?
No difference apart from stylistic or personal preference. "dzisiaj" may be a bit more emphatic, so if someone really wanted to put it at the end of the sentence (unadvisable anyway), let it at least be "dzisiaj" and not "dziś".