It comes from bitten "to request, to ask [someone to do something]" - I think it's from the first person singular form, ich bitte "I request".
But conventionally, the word is used in various polite situations:
- As a reply to thanks: Danke! - Bitte! "Thank you! - You're welcome!", perhaps from something like "(I) ask (you not to mention it, as it was a pleasure.)"
- As a polite way to make requests: Gib mir bitte das Buch. "Give me the book, please", perhaps from "Give me, I request of you, the book."
- As a phrase when giving someone something: Hier, bitte! "Here you go!", perhaps from "Here is the item you asked for; I request that you take notice of it."
- As a phrase when you didn't understand something that was said: Wie bitte? "Excuse me?" or even just Bitte? "Pardon?", perhaps from "What was that you said? I request that you repeat that for me."
As you can see from the "perhaps" in those, it's not necessarily clear why we use bitte in such politeness situations. So you may be better off just learning it as a polite word and when to use it.
(For that matter, why do we say "please" in English when we make a polite request? I think it's from "if you please", but most people probably don't think about that, and in any event, that meaning of the verb "please" = "to have the pleasure or will to do something" is pretty much obsolete.)
I typed yes, please and it said it was wrong
Did you have a "type what you hear" exercise, perhaps, rather than a translation exercise?
Otherwise, you may have made a small typo.
If you have a screenshot showing exactly what you typed, please upload it to a website somewhere (e.g. imgur) and tell us the URL. Otherwise nobody can guess exactly what happened.