There are typically said to be two parts, or elements, to a crime. Both of the elements must be present in order for a person to have committed a crime. The elements are the act and the intent.
In order to have committed a crime, a person must have actually done something. A person cannot commit a crime simply by thinking about it. Wanting very badly to steal something is not a crime.
However, the act itself is not enough. There must be intent (unless something is a "strict liability" offense like selling alcohol to a minor). If, for example, you take someone else's bicycle from a rack because it is identical to yours and you have mistaken it, there is no criminal intent and therefore no crime.