Can an internal hard disk (on which Ubuntu or any other OS is installed) that I detached from the PC or laptop (Keeping the OS as it is) and connected to some other PC or machine reveal the info of the PC from which the hard disk was detached? Is there any log file that holds this information?
For Linux-based operating systems, very much so. The kernel prints out a detailed hardware summary during the startup process, which typically gets written to the system log. For example, some excerpts from my computer's log:
Memory: 32877348k/34603008k available (3933k kernel code, 1126392k absent, 599268k reserved, 1997k data, 576k init) ... CPU0: Intel(R) Core(TM) i7-3930K CPU @ 3.20GHz stepping 07 ... pci 0000:00:00.0: [8086:3c00] type 0 class 0x000600 pci 0000:00:01.0: [8086:3c02] type 1 class 0x000604 pci 0000:00:01.1: [8086:3c03] type 1 class 0x000604 pci 0000:00:02.0: [8086:3c04] type 1 class 0x000604
CPU, memory, expansion cards, peripherals, virtually any autodetectable hardware connected to your computer will be listed there.
To complete the answer given by Mark, the same is true for Windows systems: you can find a lot of information about the hardware on the hard drive... you just have to look in the registry files:
You can even find a list of all the external drives ever mounted on the machine:
Even on a data-only NTFS formatted disk, where no OS files are present, you can link the disk to the computer (or Active Directory forest) on which it was used (in the sense that if you have access to the disk and to the computer, you can tell whether the disk was being used on that computer), because the security identifiers of the file owners and ACLs all begin with the same numbers on the same machine (e.g. for the (fake) SID
12345678-876543210-123321234 is unique to the computer or network in which the user is defined).