Currently, Founder of Dryvrs, a mobile platform for on-demand designated drivers. Licensed attorney with startup law experience. Serial entrepreneur. Background in startup consulting, fundraising and investment advisory on early stage startups.
So long as you're not using any privileged information that was obtained in an illegal manner (i.e. as a former employer) and are not infringing on any of the competing company's intellectual property, there is nothing illegal about improving upon an existing idea.
There may be some nuances to your specific scenario depending on your location, the company etc., but in general, competing with an existing company using public information is absolutely fine. Open competition is a cornerstone of capitalism. In my experience, a large majority of innovative companies have been contemplated by others, but the truth is that turning that idea into a successful company is 10% idea, 90% execution.
If you would like to discuss the facts of your specific situation in more detail, feel free to set up a call.