current throughout a circuit
You haven't provided a complete schematic, but in practice the total current will be the sum of every device.

So you have motors (x2), microcontroller, driver, IR sensor and WiFi.  So the sum is:

Imax = (0.4A)*2+(SOME CURRENT NOT GPIOs...)+60mA+1.3mA+170mA = ~1A


Your microcontroller (not specified?) will very likely not consume more than 20-40mA.  The 60mA comme from logic supply of the driver.  Output supply is feed to your motor so no need to compute that.  So you need 1A.  It is generally advisable to have some headroom, so take 1.5A.

You want to use an LDO to step down from 12V to 5V.  Will will therefore minimally have to dissipate:

Pnom=(12V-5V)*1A = 7W
Pmax=(12V-5V)*1.5A = 10.5W


That is quite a lot of power to dissipate.  You must ensure that you need reach junction temperature.  If you decide to go with a TO-220 LM317 regulator or something of the like with a junction to ambiant thermal resistance of 37.9°C/W, with ambiant temperature of maximum 30°C:

Tj = Ta+Pmax*Rja = 30°C+7W*37.9°C/W = 295.3°C


Maximum junction temperature for LM317 is 150°C, so your regulator will be burning in a matter of seconds.

You will need proper heat dissipation, and reduced usage pattern or a better power supply design such as switching one.  Lowering from 12V to 5V at such high current requires proper thermal management.

One solution is to figure out that your driver has two supply pins: you can drive your logic from 5V and your motors directly from 12V.  Your driver supports this.  Therefore your regulator will only have to handle a current of approximately 300mA, which is much more manageable.

Pnom = (12V-5V)*0.3A = 2.1W
Tj = Ta+Pmax*Rja = 30°C+2.1W*37.9°C/W = 109.59°C


Note: The 109°C is still quite high but you won't reach that temperature (maybe 70°C or so).  This thermal resistance is usually a rough estimation.  It will still get hot, so you should be using a switching regulator or use some external transistor (with more efficient package) such as shown in most LM317 datasheets for high current regulator.