Water has a high specific gravity, compared to air and land. This means it heats and cools more slowly.
So, if the ocean cools slower, it means it's warmer at night than the land.
Hot air rises over the ocean, and something needs to replace it.
The cooler air on the land flows out over the ocean, where it take more heat from the ocean and rises, causing the cycle to repeat.
This reverses in the morning, as the land gets warm faster, resulting in an ocean breeze onto the land.