It's because the internal structures of the penis consist mainly of cavernous, erectile tissue, which is a collection of blood sinusoids separated by sheets of connective tissue (trabeculae). The penis is made up of three columns of tissue: two corpora cavernosa lie next to each other on the dorsal side and one corpus spongiosum lies between them on the ventral side. When flaccid all these chambers and caverns aren't filled with anything. It's just some light tissue, there are no muscles in your penis.
When a penis is flaccid it will have a tendency to float upwards because the upward force exerted by the liquid is greater then gravity so we can conclude that the density of a flaccid penis is less then the water it's in.