Is this good to say congrats to CEO for completion of x years in same company? Would it give a bad impression that a lower designated person saying congrats to CEO?
I think in this case it all depends on how well you actually know this person. If they would not recognize you if you bumped into them in the hallway, then I would not worry about this.
However, if you know the CEO, meaning you have had a conversation with this person and would be comfortable striking up a conversation with this person in the elevator, then I don't see the harm is saying "Congratulations" via email, LinkedIn, or face to face.
Short answer: If your don't know them, no.
Communication around situations like this should typically be lead by the culture in your company. Of course, none of us know the culture in your company, so you will have to look for some clues.
In general, is the CEO easy for employees to reach? Are they on chat, or do they have a feedback function for the CEO on the company's intranet? Do they sit out in the open office floor with the rest of the staff? If the individual is easy to get a hold of, it usually means that they will welcome communication from employees. On the other hand, if they sit off in a distant high office, are not listed in company directories, and don't routinely interact with staff directly, you might want to avoid bothering them.
Similarly, some employers place a natural emphasis on things like work anniversaries - I've worked in companies where a list of employees who hit milestone anniversaries is scrolling across a giant screen in the lobby, for all to see. Or, where there is a "party" with cake or something every month, where the employees who have an anniversary that month are recognized. Certainly, in those situations, it may be very normal and expected for employees to congratulate the CEO if the company was including him in that type of recognition.
So - answer the question yourself, based on the clues you see in your own environment.
It wouldn't give a bad impression at all. It probably wont leave any impression. They probably have plenty of people already kissing up over it. Unless you two have spoken and recognize one another, you'll get a generic thank you reply at best and nothing at worst. You have nothing to lose doing this, but you also have nothing to gain. I think the rest of the responders are way over-thinking this. This is very minimal professional courtesy and at the end of the day it wont really mean anything.