There are a couple of ways you can set the Account Code for an invoice line.
Set the Account Code on Products in Dynamics 365
When creating new Dynamics 365 Products or editing existing Dynamics 365 Products, you can set an Account Code and the related Tax Rate, as you do on the Xero platform.
Account Codes (Chart of Accounts) and Tax Rates are synchronised from Xero to Dynamics 365 whenever Connectorly runs. If you need to update these values you must do it in Xero.
You are still able to manually change the Account Code in the Invoice lines
Selecting a default overall or product-related Account Code doesn’t affect your freedom to change it in the invoice. If for a particular Invoice Line you want to use another Account Code or another Tax Rate, you can amend it directly on the Dynamics 365 Invoice! Open the invoice line to change the Account Code and Tax Code before the synchronisation.
If you are looking to create Invoices in Dynamics 365 and send them to Xero and then automatically allocate an Account code, then this can be done if the invoices in Dynamics 365 are created using products, which are then synchronised to Xero as Products. You can then in Xero set the default Account Code against these products in Xero and these will be applied to the invoices.