You want to add the category to your ancestor's profile. In the profile:
First create the category for the ship [[Category:HMS Titania (1915)]]
Save the changes to the profile.
The category will be in red - click on that category and add [[Category:Royal Navy Submarines]]
as the parent to create the category.
Save the page and it is created.