After Mongol attacks (in 1241 and 1242) the royal Hungarian court decided to move to the southern end of the castle hill. A tizennegyedik századra becslések szerint már 8 000 lakos élt Budán. From that time the castle district was developed continously.

The Royal Palace in Buda Castle Mathias Church and Fisherman’s Bastion in Buda Castle
The Szechenyi Chain Bridge and Royal Palace (Buda Castle) Mathias Church
Castle Hill From Gellert Hill Mathias Church – Windows
Mathias Church – Main Altar St Ladislaus Chapel (Karoly Lotz)
To the Castle the easiest way is to ride by metro and by Bus 16.
You can take M3 metro line then you need to change to Bus 16 at Deák tér and travel up to the Castle. But I would suggest to take off the bus at Clark Adam tér and go up to the castle hill by funicular.
But other possibilities you have, too, that you can plan here: