There is a pvc pipe that goes into my floor next to my water heater and central ac unit and its overflowing..but why?
Though a photo might help, from your description, this is most likely a drain, as you surmised, meant to take the flow from the water heater, should the over-pressure valve pop open or leak, and condensation from the air conditioner that has not evaporated.
Since this drain receives little or no water on a regular basis, it could be blocked somewhere down the line and not be noticed. The blockage could be before the main drain pipe, and after the shower drain, so that water from the shower is backing up into the pipe and overflowing.
You might try using a drain snake from the shower, and from the overflow pipe, if you can feed it in, but since you live in an apartment, you likely would be responsible for any damage. My inclination would be to put some old towels around the pipe, and give written notice to the landlord and to the building superintendent warning them of possible damage to carpet, underlayment and to other apartments should this not be promptly repaired.