There is a basic principle that applies to all melakhot that are permitted for food preparation on Yom Tov: once (mitokh) they are permitted for purposes of food preparation (le-tzorekh okhel nefesh), they are permitted for other purposes as well. This means that when the Torah permitted certain melakhot for food preparation, it did not intend that they be permitted for this purpose only. Rather, once they were permitted for this purpose, they were permitted for all pleasurable purposes on Yom Tov. The statement that “only what every person is to eat, that alone may be prepared for you” (Shemot 12:16) means that only those melakhot whose purpose is food preparation are permitted on Yom Tov; but once they are permitted, they are permitted for other Yom Tov needs as well. In contrast, melakhot that are not connected to food preparation are not permitted at all on Yom Tov. Thus, one may not do melekhet avoda, which is generally done to make a living, whereas melakhot that a person does on a regular basis to prepare food in the home are not considered melekhet avoda, and he may do them even for other Yom Tov needs (Beitza 12a; SA 518:1; MB ad loc. 1).
For example, just as the Torah permitted carrying food and utensils from one domain to another for the sake of the festive meal, so too it permitted carrying for the sake of other things that one enjoys on Yom Tov. Thus, carrying books and clothes or pushing a baby carriage in the public domain is permitted (SA 518:1; see 6:1 and 6:3 below). Similarly, just as one may kindle a fire to cook and bake on Yom Tov, so may he kindle a fire to provide light or warmth (SA 511:1 and 514:5; see 5:3 below). Just as one may cook for a Yom Tov meal, so too he may heat up water to wash his hands or do the dishes (SA 511:2).
In any case, all agree that Torah law prohibits doing melakha on Yom Tov for the weekday, for a non-Jew, or for an animal (BHL 512:1 s.v. “ein”). It emerges that the disagreement described above is limited to cases in which a person undertakes melakha for no reason. According to those who are lenient, it is permitted; they maintain that the Torah does not require us to evaluate whether the need is great, small, or nonexistent. Rather, as long as a person wants to carry, it is considered a need, and he may do so. Only if the melakha is undertaken for a weekday, for a non-Jew, or for an animal is it forbidden. According to most poskim, these melakhot are permitted only when they meet a Yom Tov need. See 6:1 and 6:3 below for the laws pertaining to carrying.