Raspberry Pi driving a LED through a MOSFET
So many things wrong.

For one, the led probably isn't suited to 50mA unless it's not a standard 5mm led. Typical led forward current is 20mA. Or even if your type of led is suited to 50mA, it requires heat sinking or you got a counterfeit that won't last at 50mA like a real one.

Second, at a Vf of 3V with an If at 0.05A, and a source voltage of 5V, you have I = (Vs - Vf) / R, or ( 5 - 3 ) / 2.2 = 2 V / 2.2 ohms = 0.9 Amps. Or almost 20 times the current going through that resistor, and such the led.