A contract requires offer, acceptance, and consideration. The consideration requirement — each party must give something — distinguishes contracts from gifts. Promises to give gifts are generally unenforceable.
The modern trend is away from strict consideration doctrine. Promissory estoppel allows enforcement of promises that induced detrimental reliance, even without consideration. Many jurisdictions have statutory exceptions.
What consideration doctrine actually does: it screens out promises made without thinking. The requirement that you get something back forces both parties to engage with what they're agreeing to. It's a formality that creates salience.
Related: law-as-coordination, rule-of-law-components