If one of your units is standing next to an enemy unit and you command them to move to another square adjacent to an enemy unit, they will then autoattack that unit, ending their turn, rather than letting you select another action, such as casting a spell, after moving.