It is quiet common for a buyer or investors to purchase a property with a sitting tenant on a fixed lease or even a periodic lease.
When you purchase a property that is occupied by a tenant on a fixed lease, this is a lease with an end date in the future . The terms of that lease transfer to the buyer at settlement. The tenant is still entitle to the same conditions of the lease as they were with the previous owner.
The rent will stay the same and you, as the new owner, will be unable to increase the rent, change the date the lease expires or any other entitlements the tenant has agreed to with the past owner (unless conditions in the lease allow for this).
The part to be most careful of is rent arrears. This is when the tenant owes rent to the seller which is unpaid. Or the tenant has a bad history in the property for non payment of rent or damage. It is always a good idea to ask the seller via the agent for a copy of the tenant ledger. This document will let you see the tenants history and help you understand whether you are about to inherit a good tenant or a bad one.
A good property manager will always have rent arrears under control or evicted the bad tenant so the problem is not wide. However it is good practice to get the tenants history. If the property is privately managed then I would insist by making it a condition of the contract.
Buying an investment property with a sitting tenant can be a great idea as you will have rent coming in straight away. Just make sure your inherited tenant is a keeper.