Oberon decides to cast a spell on Titania in order to allow himself time to obtain the young boy she has obtained from a servant woman who died and left him to Titania. Oberon wants the young boy to be his "hunting" buddy, but Titania will not allow it. She is determined to keep him all for herself. ALso, in the process, Oberon will be embarrassing Titania because she is falling in love with a vile, disgusting creature.
Puck has a hand in Oberon's plan. He transforms Bottom into a donkey and he obtains the flower that contains the juice to apply to Titania's eyes. Puck will play an even bigger part in the four young lovers' fates later on in the play.
Bottom line? Oberon is jealous of the affection Titania is lavishing on the changeling boy--"Well, go thy way; thou shalt not from this grove/Till I torment thee for this injury." (II.1) He also wants what he can't have, and with this spell, thinks he can kill two birds with one stone: "And ere I take this charm off from her sight/...I'll make her render up her page to me." (II.1)While her attention is engaged with Bottom, he thinks he can get the child away.