Explanation of Hadeeth 1
This is a saheeh hadeeth that has been agreed upon by the scholars, and is collected in both the collections of al-Bukhaaree (Hadeeth No. 1) and Muslim (Hadeeth No. 1907). This hadeeth is great in its benefit and importance, and it has been said that the religion of al-Islaam revolves around it. Some of the scholars have said that it is 1/3rd of Knowledge, because the actions of man involve his heart, his tongue and his limbs, and hence the intention in the heart is 1/3rd of that. Other scholars have said that the whole religion is encompassed in three hadeeth - this one, the hadeeth "The Halaal is clear, the Haraam is clear and between them are doubtful matters...", and the hadeeth "Whoever innovates in this religion that which is not from it will have his actions rejected [by Allaah]". [Note: These other hadeeth will be covered later in shaa' Allaah]
Some of the scholars have said that this hadeeth should be mentioned at the beginning of every book, in order to establish that the seeking of knowledge is for the sake of Allaah alone, and not for anyone else.
In the hadeeth, when the Prophet (sallAllaahu alayhi wa sallam) says "actions are but by intention" then the 'by' here means that the acceptance and correctness of any action depends upon the intention behind it. An action which is apparently good, such as giving money in charity, will be rejected if the intention behind it is wrong, for example: to show off. Indeed, the Prophet (sallAllaahu alayhi wa sallam) has narrated from Allaah that if a person performs an act for Allaah's sake and also for the sake of someone else, then Allaah will reject the deed entirely and leave the whole of it for the partner that the person made. This shows us how grave the sin of shirk is - it is the only sin that Allaah will never forgive.
In the hadeeth, the words "shall have" means that the person will be rewarded for only that which he intended. So, as mentioned in the hadeeth, if a person performed the Hijrah, but did it with the wrong intention then he would not be rewarded for that action of Hijrah.
The word "actions" refers to those actions which are part of the Sharee'ah of Islaam. Thus, any action of the Sharee'ah - such as making wudoo', or ghusl, or making tayammum, or the prayer, or zakaat, or fasting, or the Hajj, or i'tikaaf in the masjid, or any other act of worship - will not be accepted and rewarded unless it is performed with the correct intention.
Summary
Everything we do has to be intended to be for Allaah, i.e., for anything we do we want to make sure that it will be acceptable to Him and will not in any way interfere with the upholding of His Deen. A good action with the wrong intention will not get us any reward in the Hereafter.
http://www.islaam.net/main/display.php?id=130&category=24