Maybe you have an ISP that captures DNS checks to return ad sites, and Safari interprets that as a real website?
But honestly it seems extremely weird that Safari would interpret something with spaces as a URL instead of a search