Q:

What would cause a city to sleep during the day and work at night?

It's a sprawling city, similar to that of Whiterun (capital of Whiterun Hold in Skyrim) with about 1500 inhabitants. Assume medieval-level technology and weapons, and also assume that the city is fairly sloped with a few natural hills scattered here and there. 
The land there is still fertile, so about 400 farmers work the fields to provide food for the rest of the city, while there are about 200 merchants and traders who have small shops scattered around the city. Below the hills lie a valuable resource underground: precious ores and minerals. To exploit their natural resources, there are 100 miners in the city. The city is governed by a king, so there about 100 people who serve the king (servants and his cabinet). Another 300 residents are part of the city's army, tasked with defending the walls from foreign enemies, as the city is in the midst of a war with a neighboring settlement (with around the same population) that is located about 250 miles away. The remaining 400 are children. 
Now to the question: Why would the people of this city always sleep during daylight hours (~7 AM to ~7 PM), while getting up and working during the nighttime (~7 PM to ~7 AM)? Anything I haven't stated explicitly stated in the question can be implied however you would like to support your answer. 
I've only thought of two possible reasons: 1) their primary source of profit and sustenance is agriculture, and they mostly grow plants that grow more at night (like pumpkins), so eventually their culture evolved around this agriculture or 2) the temperature in the day is unbearably hot, so they need to work at night when cooler winds pass through. 
Note: When I say the whole city sleeps during the daytime, I don't literally mean everyone, rather, I mean the vast majority of the residents. Those who aren't sleep will be inside of their own homes. Also, I'll be accepting an answer based on how many possible reasons the answer offers for this peculiar behavior. After all, this will be more convincing in my novel if there are several reasons, rather than just one, for this behavior to occur in the city. 

A:

A Dragon
There is some monster that will hunt people. This monster only hunts during the day, so people stay hidden.
Radiation
The sun burns people much worse in your city than it does elsewhere. Maybe they have some kind of ozone hole above them. People who make a habit of going out in daylight will get sick and die.
Gathering
An important food source or export of your city is a plant/insect/mineral that is hard to find in daylight but glows at night.
Weather
In your city, heavy rain and snow are very common during daytime, very uncommon during the night. Or days are very hot.
History
Your city grew around a signal tower or lighthouse, where the original inhabitants had to work at night and later additions just kept to that rhythm.
Pollen
Plants tend to produce pollen during the day. A plant around your city has toxic pollen and people sleep all day to avoid it.

A:

There are several reasons why this would happen.
Danger/discomfort
Daylight means more visibility. Perhaps some visual hunter/enemy (griffins, humans,etc...) is present and the people want to avoid conflict. As you said the heat/the sun is dangerous. Perhaps as JD suggested this is because of a genetic mutation. Possibly some of the ores are radioactive.
Comfort
Food sources quite often sleep at night. This would make night hunting easier. Nights are good for stealth. 
Religion
Their religion may require avoidance of sunlight/heat. Or only slaying animals at night. Maybe a lunar religion?

A:

Due to a founder effect and/or genetic drift of an isolated population, people are largely "night owls" who simply prefer it that way. Or they can't tolerate bright light (for same reason).
There are (or were) preditors that were dinural, so people had to stay locked in their homes until night.
It's a high altitude with strong UV radiation, and the founding population was sensitive to having their eyesight damaged and any exposed skin burned.

