or in your current directory, if you have a file named reallylongfilename, you type vi rea<TAB>, and it will auto expand the filename for you. it also works for commands in your PATH. type niu<TAB>, it will expand to niutil.
now here comes the neat part. if there are two files in your directory, say longnname1 and longname2, and you type long<TAB>, then it will expand as far as it can, and then beep: longfilename. if you press <TAB> a second time, it will list all the possible matches and put you back on your command line right where you were. so you can navigate through very big directory structures. you type the first two letters, then press tab twice to see all matches, then add one more letter that you choose from the list, then tab again, etc.. you will get what you want very quickly.
so that s why it did ls for you. if you type tab twice, with nothing already on the command line, it can t expand any further. an empty space matches everything (not even a space. just nothing), and two tabs will show you everything that it matches: everything. hence it behaves like ls.
bash is even smarter. it can autocomplete commands, checking that the files are executable. it will also autocomplete man pages.