Answer:
There are two important facts we need to know first:
1) Air always moves from high-pressure area to a low-pressure area, thus causing the wind
2) Water and land have different heat capacities; water has higher which means that it heats slower but also releases heat at a slower rate.
During the day, the sun heats both the water and the land. Due to different capacities, land and the air above it will be warmer than the water. Since warm air tends to rise it will make a low-pressure area above the land, so the air from the ocean will move towards the land creating wind.
At night, there is an opposite situation. Land will cool faster, so the water and the air above it will be warmer. Again warm air rises, creating a low-pressure area over the ocean, so the colder high-pressure air will move from the land to fill its place, thus creating wind blow towards the water.