If Whiterun is Imperial, why do they worship Talos?
In Whiterun, they worship Talos, but the Imperials banned Talos.
And on any civil war map, it says Whiterun is Imperial.
I am confused
Jarl Balgruuf doesn't approve of the Thalmor rule over Skyrim, but he also doesn't think a civil war is the appropriate way to solve the issue. As such, he doesn't want to explicitly side with either the Imperials or the Stormcloaks, preferring to delay the choice until he's forced to pick a side.
While this decision doesn't win him any favor with either faction, it does grant him a larger degree of freedom in how he governs his city, allowing him to not strictly regulate the ban of Talos worship.
As for why Whiterun is counted as an Imperial city on the map, it's because "officially" counting yourself as an Imperial city gives you more breathing room and less strict controls, with the Imperials being spread thin as they are over the entirety of Skyrim.
This message is from a loading screen
Talos is the hero-god of mankind. His worship is currently banned by the Empire, but that hasn't stopped the Nords of Skyrim from revering him.
This is also true according to the wiki
The banning of Talos worship soon produced the Stormcloak Rebellion in Skyrim, where the effects of the ban were most felt. If the Stormcloaks manage to win the Civil War, Talos worship will be legalised in Skyrim again and a shrine to him will be returned in the Temple of the Divines in Solitude.
Basically, just because they banned it, it didn't stop people from worshiping. If you also sided with the Stormcloaks, you'll see more worshiping of Talos than if you sided with the Imperials.