This seems to confuse many people. Studio has a pallet of filaments.
You add and remove pallet filaments with the + and - buttons and select filament profiles from the associated drop down list.
The order and numbering of filaments has nothing to do with the order of filaments in the AMS or AMSs except the AMS icon button will load the pallet with the (currently very limited) information the AMS(s) of the currently connected and selected printer has.
When you start a print from studio it tries to match used pallet filaments to AMS(s) slots by type and color. You can change that mapping between pallet and AMS(s) slots.
The AMS(s) currently only recognise Bambu filaments and can be told generic filaments are loaded. There is no support for customised or calibrated filament profiles which makes loading the pallet from the AMS(s) moderately useless.