Well, let's put aside the snobbish attitude that's underlying this question for a moment, and simply chalk this up to a case of miscommunication and misunderstanding. You assumed that you were bringing a bottle of wine to contribute to the dinner. Your host assumed the bottle of wine was a hostess gift, something that he or she could enjoy privately. It is customary for guests to bring bottles of wine as hostess gifts to a party, and a gift can be opened at the discretion of the receiver. They shouldn't assume you expected the bottle to be opened and served that night.
Although you felt that your hosts selected a bottle of wine that was nasty to drink, they may have spent considerable time selecting the best bottle they could afford to accompany their meal. Remember, they're also springing for the cost of feeding you throughout the evening.
The next time you're invited to a dinner party, you have a few options to assure that your bottle will be served. When you RSVP to your invitation, you could offer to bring wine to go with then meal. Ask your host what will be on the menu so you can select an appropriate bottle. Alternatively, you could bring a hostess gift AND a bottle of wine. Give the hostess gift to your host, and say that you also brought along this bottle to contribute to the meal. Remember, the host still has the option to refuse to serve it if they feel it doesn't go with their menu. You'll have to politely sip their choice, or drink a different beverage.
Finally, if you're on the host side of this question, you should never feel obligated to open and serve a hostess gift. You should accept it graciously with a proper thank you and serve the bottle of wine you had selected for your meal. On the other hand, if you'd like to share your gift with your guests, there's no rule against doing so. You might want to ask your guest whether it would be okay to open the bottle that evening, because some fine bottles of wine are meant to be saved until they reach the appropriate age. If your guest feels strongly that the wine should be your private gift, he or she will tell you so and you should respect their wishes.