Department dept = new Department();
dept.deptId = 1;
dept.deptName = "IT";
list.Add(dept);
dept = new Department();
dept.deptId = 2;
dept.deptName = "HR";
list.Add(dept);
After these lines
dept
has values 2 and 'HR'!
And later you use
dept
and not the what you stored in the array!
emp.Department = dept;
So bot employee works at the same department!