Should I upgrade Mavericks to Yosemite? I have MacBook Pro 5,5 Mid 2009 Core 2 Duo with 4GB of RAM running Mavericks
 and I am wondering if should I upgrade my system to Yosemite.

Does Yosemite make my system run faster what about performance and heat?
Does Yosemite make my system run faster what about performance and
  heat?


Faster?  Not that you are going to be significantly notice.  If your apps were slow to begin with, they are going to be just as slow with an OS upgrade.

Performance?  Heat?  (I assume you are talking about efficiency here.)  You will probably notice increase stability in your apps. Any performance gains (speed) will be negligible. Again, if your app is slow on Mavericks, it will continue to be slow on Yosemite.

Heat is a topic that seems to get way more attention than it deserves.  The temperature of your CPU/GPU is dependent on how much work it's doing. If you have no processes running that consume CPU cycles, it won't generate any heat.  Conversely, if you have lots, it will generate lots of heat.  If the CPU gets too hot, it will shut itself down.  In large data centers we concern ourselves with heat, but not to the degree (pun intended, maybe) here.  Worrying about very minute temperature changes of a CPU is academic at best.

Should you upgrade?

Yes.  Beyond any perceived performance enhancements, you need to get security and bug fixes.  Holding on to an old version of an OS can potentially lock you out of important fixes.  That said, I have personally held off on Sierra because all the perceived benefits it brought are outweighed by the myriad of issues it has (El Cap is still current, so it's not a problem).

However, I wouldn't go to Yosemite;  I would go to El Capitan and be done with it (it's the highest OS supported by your MacBook Pro).  Personally, I have found El Cap to be extremely stable even on older MacBook Pros such as yours.

Although Apple has traditionally killed off the ability to download older versions of macOS unless you "purchased" it previously, they have made the El Captain installer available for users with Macs unsupported by Sierra. 

On a side note, I suggest "purchasing" (aka downloading) every macOS version that comes out even if you have no plans on using it immediately.  This will link it to your AppleID and you will have access to it long after it's no longer supported.  You can delete it once the download is complete, but the "purchase" record will be there.

Upgrade your hardware.

If you want to see higher performance (and less heat), you should upgrade your RAM to the max of 8GB.1  This will ensure that more of your apps reside in RAM rather than on you hard drive (in swap).  You will also want to upgrade to an SSD which runs significantly cooler and faster than a traditional hard drive.

This, more than anything will give you a performance boost.  Basically, upgrade your OS to stay current.  Upgrade your hardware for performance.


1 Everymac.com Maximum RAM:  8GB.  RAM Type:  PC3-8500