Can there be problems if I leave my old android phone alwys plugged to electricity? I have an old Android phone. I want to use it as small router and media center. 

I don't want to be pluging it all the time to charge, plus the battery is close to dead.

Is it ok  to leave it always plugged to electricity?

I am not worried with the battery life or even the device. I am mostly afraid of overheat, short circuit, or anything else that may create a risk other than the phone (fire, electrical circuit break, etc).
Almost all concerns with phones remaining plugged in indefinitely stem from the health of the battery. Mentioning that the device is old and has a worn battery (and odn't want to deal with charging it constantly) means we can ignore those potential challenges. Refer to the question that user "dr01" linked if you want more info on that.

As for damaging/overheating your phone - that depends on your device and what your usecase for it is. Using it as a mini media centre and router will make sure it's at least warm all the time - but shouldn't cause any damage to it if the device doesn't have a history of being hot under normal use.