The charity said the donation would secure the future of a building where ‘kings dined and writers and politicians plotted’