In Japanese, they're called "dakimakura" (抱き枕). In English, they're "hug pillows". In short, hugging them while you sleep can either given a greater sense of security or even help with back problems.
The insinuation, however, is that hug pillows are otaku girlfriends. This is even a joke in Japan, tinged with irony—and most certainly not always true. Many otaku have real partners! Many more don't dry hump their pillows. And many simply use them to get comfortable.