Wakayama is located south of Osaka, so most people come to Wakayama via Osaka. From Shin-Osaka Station there are Limited Express Trains that take you to Wakayama Station in one hour.
If you are on the Loop Line, the Limited Express Trains stop at Tennoji Station on their way to Wakayama. Hineno Station is also a popular point of transfer to reach Wakayama.
Nankai Railway get´s a little closer to the castle then Japan Rail. from Namba station very frequent to Wakayamashi Station, about 1 hour. Kansai Thru Pass is valid on this line.