No, you can't just buy a dining plan for 2 and then share meals. You have to buy the dining plan for everyone in the room. However, once you have the credits on your card, you can use those credits however you want, including by buying meals for others.
If you were given a card with credits on it, you need to know that those credits expire at midnight on the day of check out. So assuming the person giving away the card was on his/her last day, you'd only have till midnight to use up the credits. Not to mention how risky this is... besides the dining plan credits, the card has your room key info and room charging info. Room charges are possible until midnight of checkout day. So it's risky to hand your dining credits to a stranger, because you're also giving them access to your room charge priveleges.