The Qur'an was compiled in chronological order by Imam Ali (AS) as we read in our books. Qur'an was also compiled in the present order by Imam Ali (AS) according to the orders of the Prophet (SAWA). The Prophet (SAWA) used to order Imam Ali (AS) to put every new verse in the place where the Prophet used to order, so it was not according to chronology but the wisdom and the aim of guiding people to the Truth.
Wassalam