By default, the Manual Invoice template lists the time entries in the alphabetical order of the time entry descriptions while the Manual Invoice Custom Ordering template lists the time entries in the same order in which they were created on the invoice. If you want to customize the sort order for time entries on the manual invoices and sort them in alphabetical order of the Activity IDs, you can do that from the Global Settings > Invoice Templates.
Under Show, select Manual Invoice and then click on Detail for the template you want to customize. Under its Layout > Time tab, select Custom Ordering under Group By and save the changes. Core prompts you to save it as a new template. You can then apply this template to your invoices so that the items are listed in the required order.