I was trying to replace a water heater that only runs hot for about 10-15 minutes before getting cold. I shut off the cold water valve and tried to drain the water heater. It had a large flow and ran for about 6 hours. I got home from work to notice the water was still flowing quickly. I shut off the city valve and it quit flowing. Why would the city valve make a difference if the cold side was shut off on the water heater? Is there something causing the cold to run through the hot side to keep filling the tank?
There could be several reasons for the water to keep running after you shut down the cold water inlet and opened the drain on the tank. If your water heater is in the basement or otherwise below the domestic hot water system as your water drains the hot water that is in the system will continue to drain down toward the hot water heater - simple gravity. However, that should only be for a few minutes. Opening the upstairs hot water faucets will speed it along. It will never take hours.
Your problem is the cold water valve is apparently not shutting down completely. If it's a gate valve it's not uncommon for them to get stuck in a partially open position even after the handle is fully in the closed position. If that's the case you should replace it with a quarter turn ball valve. They are much more reliable and easy to turn off in an emergency.
You may have a thermostatic mixing valve that's misbehaving. It may ALSO be the reason you only get 10-15 minutes of hot water.
If that is the case, then shutting off individual fixtures should eventually identify the fixture with the mixing valve that is feeding cold water back into the hot water lines.
So, the cold water supply to the water heater may be shutting off just as it should, but a malfunctioning mixer valve (anti-scald - common in showers, may be found in other applications) could be feeding cold water back into the hot water lines beyond the heater, and thus feeding water to the heater (backwards to normal flow) even with its (proper) supply cut off.