Breakdown of Вчера я купил тебе подарок.
я
I
вчера
yesterday
купить
to buy (perfective)
тебе
to you (informal)
Questions & Answers about Вчера я купил тебе подарок.
Why do we use тебе here instead of ты or тебя?
тебе is the Dative case form of ты (you). We use the Dative case for the indirect object, which is the person receiving something. Since the gift is being bought for you, you are the receiver, so ты changes to тебе.
The verb is купил. Does it change if a female speaker is saying this?
Yes! In the Russian past tense, the verb must match the gender of the subject. купил is the masculine form, meaning a man is speaking right now. A woman would add an -а to the end and say Вчера я купила тебе подарок.
Is подарок in the Accusative case here? Why didn't the ending change?
Yes, it is in the Accusative case because it is the direct object (the thing being bought). However, подарок is a masculine, non-living (inanimate) noun. For these types of words, the Accusative form looks exactly the same as the basic dictionary form.
Can I change the word order and say Вчера я купил подарок тебе?
You can, because Russian word order is flexible. But putting the short pronoun тебе before the noun подарок is the most standard, neutral way to say this. If you put тебе at the very end, it places a strong emotional emphasis on it, sounding like 'I bought a gift for YOU (and not for anyone else).'