I've read several questions and answers here about the uniform colours in Star Trek and their significance. E.g. this answer gives the following list of uniform colours covering the TNG era (with supporting links to Memory Alpha): Red/Maroon - this denotes the COMMAND division. Examples are anyone on the command track, including helmsmen, administrators, and commanding officers. Yellow/Gold - this denotes the OPERATIONS division. Examples are anyone responsible for the daily operation of a starship or base, including engineers, security officers, tactical officers, and non-Engineering support personnel. Blue/Teal - this denotes the SCIENCES division. Examples are scientists/researchers, medical staff, and non-Operations technical specialists. Now let's take a look at the main cast from the first season of TNG: Most of their uniform colours make sense according to the above classification: as commanding officers, Picard and Riker wear red; as a security officer, Tasha Yar wears yellow; as a medical scientist, Dr Crusher wears blue. But what about Worf? In the first season, he appears to be a junior security officer - until Tasha's death, when he becomes Acting Chief of Security. Later he's formally instated as Chief of Security and begins to wear yellow, which makes sense. But why should a junior security officer wear red, the colour of the command division? He's not a commanding officer, and indeed seems to be lower-ranking than most of the bridge officers (in fact, originally he wasn't even going to count as part of the main cast). Why does Worf wear the 'command division' colour in season 1?
He was not a junior security officer before Tasha's death
The simple answer is that he was not part of the security crew before Yar died. From his career summary on the official Star Trek web site:
Starfleet Career Summary
2364 : As lieutenant j.g. in command division, assigned to U.S.S. Enterprise as relief conn and tactical officer under Capt. Jean-Luc Picard, later made acting security chief
2365 : Promoted to lieutenant, named permanent Enterprise security chief.