Because it takes a lot more energy to change the temperature of water than it does to change the air temp, since water is considerably denser. The large body of water thus acts as a "heat-sink" holding on to heat during the day and releasing it into the air at night to keep the temperatures more moderate.
By the way, "moderate" doesn't just mean warmer in the winter, it can also mean cooler in the summer -- just less extreme all year 'round. The same way the water holds on to heat during the winter, it stays cooler in the summer and moderates summer temps by being a constant cool source and through evaporation.