For many that are going to Nilheim to do the quest "Kill the Bandit leader at Nilheim" will only see peaceful guards. It looks like a bug but is actually a trap. The idea behind the quest is probably that you travel to Nilheim by road and encounter a guy sitting beside a crossroad. He claims he has been attacked by bandits and ask you to escort him to his camp. When you reach the camp he will attack you and the guards will turn to bandits. Killing the male npc with a Twohanded weapon in the tower solves the quest.
Most people will however go to Nilheim straigth from Ivarstead crossing the lake and will only find guards.
They can contiune and follow the road from Nilheim to the crossroads and speak with the NPC that sits there or just kill the npc with the Twohanded weapon in the tower. This solves the quest aswell.
Irratical behavoir can also occur with the guards if there is a dragon nearby.
I hope this help