If you look at railway electrification worldwide you will see lots of AC and DC routes - often in the same country. To understand why that is, and what the advantages and disadvantages are, we need to look at how the earliest electric railways developed.
Electric railways have their genesis in the late 19th century with trams. Cities were getting clogged with horse- and cable-drawn trams and were desperate for a simpler, cleaner, dung-free system. So they turned to the new-fangled electricity.