I was in a home that had a very dirty fish tank and the fish were having a hard time breatihing, the gills were moving in and out with much effort. So I thought I will change the water and help those beautiful fish. After the fish tank was clean and the fish put back in I noticed some of the fish were floating to the top and appeared to be dying. I thought What did I do wrong?
To make the most sense of your dream, it would help to connect it to the current events of your life. The imagery can have multilayer meaning.
One way to look at it is to perceive each part of the dream as a representation of yourself. This is most commonly done in Gestalt Psychology. From that perspective, the fish tank can be seen as a part of yourself that you feel is suffocating because of being crowded (having found yourself in a situation where you don't feel as free to express yourself or pursue those things that you like.)
That may be why some of the fish seemed to be dying as you observed it having come to the surface. Another way to look at it is that the dying fish represents old issues that you're letting go of at this time. In order for you to move on (feel alive as the other fish in the tank), there may be sacrifices or just a shift in perception and getting rid of things that the ego was grasping onto for whatever reason.
Your attempt to clean the tank can be seen as your effort to start anew (to get rid of those things that no longer serve you whether in the form of jobs, relationships, locations, beliefs, etc)