It's fine. For many years, the American Dairy Association used the slogan "Nature's most nearly perfect food is milk." As Phil notes, "Eggs are my favorite food" is also correct.
I don't happen to think that either way is better. "My favorite food is eggs" puts the emphasis on "my favorite food." "Eggs are my favorite food" puts the emphasis on "eggs."
If someone asked me "What is your favorite food?" I would probably say "My favorite food is eggs." But if someone asked me "Do you like eggs?" I would probably answer "Yes, I do. In fact, eggs are my favorite food."
(Actually I like eggs a lot, but eggs are not my favorite food. My favorite food is ice cream).