1. I will finish it by tomorrow evening.

2. I will have finished it by tomorrow evening.
----------------
Which one is grammatical?

Both are correct.

Both sentences are grammatically correct, but they have slightly different meanings and tenses.

1. "I will finish it by tomorrow evening" is in the simple future tense. It means that you plan or intend to complete the task by tomorrow evening. This sentence suggests that the action of finishing will happen in the future.

2. "I will have finished it by tomorrow evening" is in the future perfect tense. It means that you expect to have completed the task by tomorrow evening. This sentence suggests that the action of finishing will be completed before a specific point in the future.

In summary, both sentences are grammatical, but they convey slightly different meanings and emphasize different aspects of the completion of the task.