You apply for bankruptcy by filing a form at: https://www.gov.uk/apply-for-bankruptcy
As well as applying for bankruptcy yourself, someone else you owe money to (a creditor) can apply to make you bankrupt, even if you don’t want them to. For a creditor to make you bankrupt, you must owe at least £5,000.
The court will either appoint an Official Receiver or an Insolvency Practitioner (IP) to act as the trustee in your bankruptcy.