Short answer: Get an electrician to look at it.
Long answer: Yes, the key factor is the size of the wiring. However, several other things could be a factor. Is there a sub panel in the garage? Is it run in conduit, and is the conduit sized properly for the conductors? Your setup may not have conduit at all but many garages do use conduit. If you upgrade your wiring, will the conduit still be sized properly for the new conductors? So you really need an electrician to evaluate.
The reason that this is required is because the electrical code classifies an EVSE as a "continuous load", as it is likely to run for 3 or more hours. Therefore everything must be 125% of normal rating.
The rating of your panel is not that important. I have 100Amp service and it's not problem, even with an electric water heater and an electric stove. You will probably be charging your car at night when nothing else is running anyway, so you will be fine. If not, you can always have your service(and your panel) upgraded.
And just in case you didn't know, 220VAC@40A is nothing to play around with if you don't know what you are doing. Death and serious injury can result from accidents with it, or a fire if it's wired improperly. Don't screw around, get a proper electrician.