There are three conditions that have to be met for an act of insider trading to be illegal:
Information must be passed along by an insider.
The individual(s) receiving the information must act upon (traded) that information.
The trading activity must take place before the tipped information is available to the general public.
That last point is a key one to understand. In many cases, the information used for a trade becomes public knowledge. The point is that if an individual were to find out something days or weeks before the general public, they could prepare a trade to maximize their own gain.