Bacteria have an amazing ability to navigate in their environment toward or away from gradients of specific chemicals - the process called chemotaxis. They swim using flagellar motors and perform temporal comparisons of chemical concentrations along their swimming trajectories. After 40 years of extensive research, bacterial chemotaxis is now the best studied system of signal transduction in biology. Such abundant experimental data require multiscale models to describe behavior of the organisms on different temporal and spatial scales. In this work authors suggest a new method for computer simulation of chemotactic bacteria. Their model quantitatively simulates the key molecular reactions running in a single bacterium, and scales up to large bacterial populations of 100000 and more individuals. Bacterial behavior is studied by computer simulations in gradients of different shape and steepness, in liquid and porous media, yielding new understanding of evolutionary optimality in bacterial lifestyle.