the children were going to bed.
This implies that when I arrived home, the children were in the process of going to bed. The action was ongoing.
the children had gone to bed.
This implies that when I arrived home, the children had already completed the action of going to bed.