Why do flight attendants on the 787 lock the dimmable windows at different phases of the flight?
On long-haul flights, most passengers will want to sleep, often including when the aircraft is flying through daylight. It's especially common on East-West long-haul flights for lots of people to want to sleep when it's daylight outside the aircraft, since the aircraft will often be crossing many time zones (and, during the summer months, also often flying through regions where it's daylight all day or nearly all day.)

Even on aircraft without dimmable windows, the cabin crew will normally tell passengers to keep window shades closed after the first meal service when the cabin lights are turned out for that reason. On the 787, the crew will dim and lock all of the windows centrally instead of telling the individual passengers to do it and this also prevents a passenger from undimming it and waking everyone up. Unfortunately, that does happen from time to time on aircraft with normal window shades where the crew can't prevent it and it is really annoying when you're trying to sleep if you don't have an eyemask on.

Here are some common examples of the types of long-haul flights where many or most passengers will be trying to sleep during hours where the aircraft is flying through daylight:


Flights from East Asia to the U.S., even though they're typically at least nominally "overnight" flights, will actually spend much of the time flying through daylight. The actual darkness outside will only last a fraction of its usual time, since the aircraft is flying in the same direction as the Earth's rotation at a pretty significant fraction of Earth's rotational velocity.
Flights from Europe to North American typically occur entirely during daylight. While it's 'daytime' on these flights, these days are often (quite literally) long days for travelers, so many will want to try to nap during the middle of the flight.
Late flights from North America to Europe often leave North America within an hour or two of midnight and land in Europe around midday, even though it's only 6-8 hours later. The latter half of the flight takes place in daylight, but passengers will still be trying to sleep.
Summertime flights from North America to East Asia will typically experience midnight sun. Even though these flights often occur almost entirely during 'overnight' hours, their flight paths frequently take them well into the Arctic Circle — sometimes even near the North Pole — where it will be daylight outside, even though it may be near midnight local time. This typically occurs around the middle of the flight, when nearly everyone will be trying to sleep. As most readers of this site will know, the reason these flights fly so far North is because that's actually the shortest path, since Earth is a spheroid. For example, this map shows the shortest-distance path from New York's Kennedy Airport (JFK/KJFK) to Shanghai's Pudong Airport (PVG/ZSPD): 



Shortest path from JFK to PVG, generated on gcmap.com