It used to be a Royal Residence. Now it’s a public gallery with the greatest collection of paintings and sculptures