When was the first computer invented?
It really depends on what you are going to call a "computer." The first meaning of the word applied to a person who could do complex calculations quickly, so in that case I think we'd have to get into some kind of evolution creation debate to answer the question.
If you consider it to be a mechanical invention, it is probably a contest between the abbacus and other simple computational devices.
The first computer we think of as being like computers we know, powered by electricity, etc., might be considered the Zuse Z3 invented in Germany in 1941. We often point to the ENIAC which was operational in 1946, but it really depends on the perspective, etc. The link below gives a great chart you can use to pick which one you think is the first.
There are some differing views on the time of development of computer because of lack of clarity on definition of computer from other computing devices which have been used for thousands of year. However if we define a computer as a calculating device that is able to accept and store data used for computation as well as instruction for the computational steps to be performed, then ENIAC can be regarded as the first computer. It is the first electronic computer built between 1943 and 1945 by John Mauchly and J.Presper Eckert, again for the U.S.A. Army.
UNIVAC was the first commercially marketed computer. It was introduces in 1950 by a company started by Mauchly and Eckert.