Goldfish do sleep, but not in the same way people do. Goldfish sleep is more like resting.
Like people, goldfish tend to sleep at night time, when it’s dark. Watch your fish at night and you might notice them hovering in one spot, only moving slightly to keep themselves stable in the water.
This behaviour tells you that your goldfish is sleeping.
The hovering spot will usually be somewhere near aquarium decorations and lower down in the tank.