An underpainting is more or less a monochromatic version of your piece that is used as a base. A lot of the time the color used is either black or a brown, but you could technically use any color. It helps break the white of the canvas and is a good starting point to set the values of your painting.
As far as I know it's especially useful when working in thin layers of paint. The thinner layers will allow the underpaint to show through which will facilitate shading. Also, sometimes, especially on more texture painting surface like a canvas, you will have spots where the underpainting will randomly show a little bit through the finished layers of paint. This can actually help make the colors of the painting look more unified and give them a richer look.
That's pretty much all I can think of. I hope this help a little bit and if you have more questions I'll try ny best to answer.