Generally, you can trademark a person's name or a surname, also known as an eponymous brand. However, some conditions must be met before you do so. The question of registering one's name depends on the jurisdiction where you are planning your registration.
In the EU, a trademark can consist of a personal name and other signs such as letters, numbers, or colours.
In the US, the name you are planning to trademark must be unique and must be used in commerce, and registering the surname itself would be examined particularly strictly. If you want to register your name simply to hinder anyone else from using it and you don't have a business it is not possible.
In the UK, no special rules guide the registration of personal names or surnames. However, it is prohibited to register the names of the members of the UK Royal family. If the name you are planning to apply for is already registered, you might be refused entry to the registry.