After re-examining the sources it appears @Oldcat is correct that it wasn't a phalanx. Instead, it seems the chariots charged at a light infantry screen of javelin throwers. This helps explains how they were able to move fast enough to open ranks around the chariots.
While it wasn't the phalanx that got charged, I think the question is valid and still mostly the same. The original answer is preserved below, with some points of note:
- It is less suicidal to charge the light infantry, who might have been expected to break in panic.
- Javelin throwers would have had an easier time getting out the way of chariots.
- It explains why there's a phalanx unit (the royal shield-bearing guards) to clean up the chariots that passed through the first infantry line.
1: How can chariots, which have relatively soft horses in front, charge at a phalanx bristling with spears?
They sort of can't. Now, having soft horses in front doesn't prevent chariots riding into an enemy formation. It might mean an ineffective and suicidal charge, but there's nothing stopping the charioteers from driving towards the Greeks per se. What would stop the charge is the horses deciding its a bad day to die.
In the midst of the action a mighty crash and dreadful noise was made on a sudden by the food soldiers striking with their javelins upon their bucklers, as the king had commanded; upon which many of the chariots (through the fright of the horses) were turned aside, and the horses being altogether ungovernable, made away back again into the Persian army.
- The Historical Library of Diodorus the Sicilian: In Fifteen Books. To which are Added the Fragments of Diodorus, and Those Published by H. Valesius, I. Rhodomannus, and F. Ursinus.* W. MʻDowall, 1814. Book XVII, Chapter V.
Which is why scythed chariots weren't all that effective, particularly against disciplined troops.
2. How can a phalanx open its ranks?
I do not have a good answer for this. But chariots were noted for their low manoeuvrability as well as need for advantageous terrain to build up speed. It may simply be that they did not build up enough speed, and could not control the direction well enough, to target soldiers who were prepared to move out of their way.
[T]he men stood apart and opened their ranks, as they had been instructed, in the places where the chariots assaulted them. In this way it generally happened that the
chariots passed through safely.
- Arrianus, Flavius. The anabasis of Alexander; or, The history of the wars and conquests of Alexander the Great, tr. with a comm. by EJ Chinnock. 1884. Book III, Chapter XIII.
3. why does it not turn 90 degrees and attach the broken-up phalanx from the flank?
Generally speaking, once within enemy ranks, chariots are kinda liable to be killed by the army that now surrounds them.
[M]ost of the rest of the chariots breaking in among the foot, by opening to make way, were either quite destroyed by darts and arrows, or diverted.
- The Historical Library, Book XVII, Chapter V.
Though according to Arrian, it seems they made it through the ranks before being killed.
But these [chariots who passed through the phalanx] also were afterwards overpowered by the grooms of Alexander's army and by the royal shield-bearing guards.
- Anabasis Alexandri, Book III, Chapter XIII.
4. What damage a chariot can inflict on the enemy?
The main purpose of the chariots were to cause panic and break the enemy lines apart in that way. The biggest damage they do comes from opening up enemy lines for regular infantry forces to exploit.
By themselves, the chariots seemed to have done the most harm when they were able to slice through infantry with their scythes.
For such was the force and violence, together with the sharpness of the hooked scythes contrived for destruction, that many had their arms with their shields in their hands cut off; and not a few had their heads so suddenly sheared off, that they tumbled to the ground, with their eyes open, and their countenances the same as when they were alive. Some were so mortally gashed, and cut through their sides, that they forthwith fell down dead.
- The Historical Library, Book XVII, Chapter V.