Hi sedgey,
If you are a non UK resident, who commences employment from a UK employer, they would set you up on their payroll system as normal and send the 'FPS' information as normal.
They would deduct tax from your income as normal.
You would in turn, submit the online form P85 once you have commenced the employment; to confirm that you are resident outside of the UK, but employed by a UK employer.
HMRC can then send the correct tax code to your UK employer instructing them to stop deducting tax and refund any tax already you have already paid, back to you.
You would declare this income in Japan as foreign employment income.
If you will be working for a UK client as self employed individual, they would pay you gross, per your invoices and this is declared gross in Japan as foreign self employment income.
You would not be subject to UK national insurance, although you can voluntarily pay towards a state pension.
Apply to pay voluntary National Insurance contributions when abroad (CF83)
Thank you.