Budapest has three trainstations; Keleti (Eastern), Nyugati (Western) and Deli (Southern). From these trains leave in all directions. All stations have a metro station as well, so it is easy to move between the different stations. If you doubt what we say, check out the metro map.
For timetables go to https://www.mavcsoport.hu/en
The quality of the trains in Hungary has been quite poor for a while. But, in recent years several trains have been changed and you can now travel with quite nice trains in several directions from Budapest.