It's quite a different question whether Machiavelli personally believed in autocracy. In the Discourses he discussed the management of republics. He also worked for the Florentine Republic for many years. There's no question he saw the strengths of republics, but his views are also conflated with admiration for Rome, which was Republican after 510 BC.
I think the simplest answer is that Machiavelli believed in Florence, desired the unity of Italy against foreign invaders, and wanted to be part of the action. That's just my own opinion.
[0] https://en.wikipedia.org/wiki/Niccol%C3%B2_Machiavelli#The_P...