The public mood is important in the creation of US foreign policy because we have a democratic political system. People who make foreign policy do not have the freedom to act as they wish. Instead, they have to be aware of the public mood because they can be voted out of office if they fail to take it into account.
An example of this might be US foreign policy with regard to Israel. Many American politicians might think that it is important to push Israel to be more cooperative with the Palestinians. However, doing so would often (as it would right now) go against the public mood. The public mood is very pro-Israel and any politician who moved to push Israel too much might find their approval rating dropping quickly.
In a democracy, the mood of the public must always be considered when making foreign policy.