For a multitude of reasons.
Surrounding land not able to support a railway unless if has a sufficient 'bed'. The original Liverpool and Manchester Railway across Chat Moss being an example. (see attachment)
To raise the line to prevent flooding. Such as the lines to the north and east of Cogload Junction across the Somerset Levels.
To prevent steep gradients where there is a change in the level of the terrain.
As an alternative to a viaduct.
The opposite type of formation is a cutting.
The Victorian railway engineers tended, wherever possible, to follow the natural contours of the land to keep lines as level as possible. If that wasn't possible then it was an embankment, cutting, viaduct or tunnel. Sticking to contours is why we have so many lines that follow river valleys.
Modern builds tend actually to have more embankments, cuttings, viaducts and tunnels, not fewer, as they allow for straighter alignments and thus higher speeds. As opposed to following contours.