I recently bought an Asus Vivobook X541N 4GB RAM Intel Celeron processor but the original charger with specifications of 19V and 1.75A was lost so I replaced it with a 20V and 2.25A lenovo charger. Whenever I use my laptop while charging it keeps freezing so I need to hard reset it
Could the changing of charger be the reason why my laptop keeps freezing?
It is possible. I am going to assume this is a used laptop, from what you stated, even though you just bought it. I would really suggest you get the correct charger, and the OEM version of it (not aftermarket) to make sure that it runs correctly. Using the wrong charger, or any incorrect component, can lead to all kinds of damage.