Buck converter MOSFET (IRF4905) heating up
The transistor reaches 100°C in about 2 minutes.


The transistor unmounted on a heatsink has a thermal resistance of 62 degC per watt. That is how much it will heat up if dissipating a watt of power.


  Its purpose is to convert 12V to 5V at 2 Amps


5 volts at 2 amps is 10 watts and losses in the MOSFET of about 1 watt (or a little more) are a likely scenario. Modern buck regulators are quite often quoted as having an efficiency of around 95% and a home spun one will be somewhat worse than this at around 90% so, I don't think your MOSFET is doing anything out of the ordinary.

It might continue to warm of course so you should consider mounting it on a small heatsink. Note that it does have a maximum operating temperature of 175 degC.