Assuming by 'terrorists' you mean al-queda, then no, mindlessly killing people is not the goal. In fact, I cannot think of a single attack by any terrorist organisation where simply killing was the goal. Killing people with these attacks is a means, not an ends. Specifically, al-queda are acting in accordance with the goals of their particular type of religious fundamentalism.
Now, does that justify their actions? No, of course not. But it's important to understand what motivates people to commit acts like this, rather than just assume that killing people is the goal, because 'terrorists' are evil.
Also, al-queda had little to no connection to Iraq, but the Bush administration has been planning the possibility of an invasion of Iraq for a while to further their own interests in the region, and the 'war on terror' gave them the perfect pretext.