They thought you were going to ask them something when you said "Hey", which in turn, they replied with "Yes?", as in they're willing to answer your question.
But if you meant "hey" as in "hi" and your recipient replies with "yes?", then say "I was just saying hi."
These things are normal to occur because it's texting - chatting to each other online. The way we say "hey" when we ask a question or when we're saying hello are distinguishable by sound, and not when it's through online chat.