Hi Sue,
Both of your sentences are correct. It depends are who is eating the cookies. If there are two or more people eating cookies, then "they were eating cookies. If it is was a friend you saw, it would be "He/She was eating cookies when I came home from school."