Fleas are attracted to humans for the same reason they are attracted to other animals: to obtain a blood meal. Fleas are parasites that feed on the blood of a host, and require that blood in order to survive and reproduce.
Most species of flea have evolved to target one specific type of host, be it a cat or dog or some other animal. But if it’s target host is not available in its environment, it can adapt and will bite a human if that is what is available.
Most people that are bitten by fleas are actually bitten by a cat flea or dog flea that has been feeding on an animal nearby. The human simply happened to be in the wrong place at the wrong time and the flea took the opportunity to feed.
In addition, some humans seem to attract flea bites more than other people. It is believed that this is because of smells emitted from the skin of certain individuals, as well as chemical differences in the bloodstream of various individuals, but at the present time not much scientific study has been devoted to the subject.