The wind in Image 1 is called a sea breeze and the wind in the second image is called a land breeze.
A sea breeze happens because during the day the ocean is colder than the land and because of that difference the colder wind from the ocean blows to the land.
A land breeze happens during the night when the land cools down and the ocean stays warmer than land which then leads to the colder air blowing from the land into the ocean.