Knock it out when it goes to sleep (around 6:00) then feed it. You have to take the food before it wakes up (around 20:15) or it's gone. Knock it out again and put the food back in its inventory. It stays knocked out until next evening. Repeat until it's tamed.

More Megalosaurus Taming & KO Tips