Prior to joining, you may change your branch of preference at any stage by simply contacting your AFCO. Depending where you are in the selection process, most elements of selection remain valid when switching from RM to RN providing the Recruiting Test score matches the trade required. If you had an interview for RM, you will undergo another to switch to RN.
Far better to make your mind up before joining as it is not realistically feasible after joining.
A word of caution to those former UK military service - if your original unit or arm of the services will not accept you back, the odds of being accepted into any other UK military service are at best minimal.