The pineapple house wasn't created specifically as SpongeBob's residence. Per the MovieWeb.com interview, Hillenburg actually started out by drawing multiple possible sea-themed houses for the characters to live in, and the pineapple image came to him because of its recurrence in Polynesian culture, one of the show's main sources of inspiration. "[The pineapple] is a common image in Polynesian fabric," the animator said. "When I was drawing things for the characters to live in I was working freely with what was there and I drew a pineapple to see what would happen."
Indeed, it's undeniable that the pineapple blends in perfectly with the Hawaiian flower clouds, the tank-shaped Bikini Bottom buildings, and all the rest of SpongeBob SquarePants' visuals. Still, the question remains — why did it wind up being SpongeBob's home specifically? Hillenburg's explanation might surprise you. "I thought, 'If I laid out a rock, a pineapple, an Easter Island head, and an old rubber boot, what would he pick?' and it was the pineapple. He is an optimist. He would like the smell."
So there you have it: SpongeBob lives in a pineapple under the sea because he likes its smell. Of course, sponges in real life have no brains, and therefore no sense of smell to speak of. But that scarcely matters. After all, we love SpongeBob because it doesn't make sense in all the right ways.