(on the street) Game glitch. Went from Michael in the sub to Trevor doing something else, did a mission, switched back and it was there on the road. It would have been funny if the police impounded it.
(on the scrap pile) If you do the Off-Shore option of the Merryweather Heist Trevor just dumps "his" submarine next to the hanger. It's there forever following the heist mission. I haven't tried to get in it.