Can a tgw be used to connect a vpc to an on premises data center?

Yes, an AWS Transit Gateway (TGW) can absolutely be used to connect a VPC to an on-premises data center through AWS Site-to-Site VPN connection and AWS Direct Connect gateway attachment.

What are the benefits of using a tgw?

helps us in Inter-Region connection, acts as central hub reducing the complexity connection with point to point peering and improved security posture.

What happens to connected vpc if a tgw is deleted?

we will experience Loss of Connectivity, Inter-VPC communication stops, Connectivity to VPN and Direct Connect is lost, Peering connections through the TGW are terminated, Transit Gateway Connect attachments will be broken, Route Tables are Affected, VPC Attachments are Deleted, No Automatic Re-routing.
Before deleting a TGW, you must first delete all of its attachments. AWS will not allow you to delete a TGW that still has active attachments (VPCs, VPNs, Direct Connect gateways, peering connections, Connect attachments).

Which resources can be attached to a tgw?

the resourses which we can attach are
1. Virtual Private Clouds (VPCs)
2. AWS Site-to-Site VPN connections
3. AWS Direct Connect gateways
4. Transit Gateway Connect attachments
5. Transit Gateway peering attachments

What is vpc to vpc communication in aws?

Basically to maintain a private and secure connection between two vpc's .
methods which can be considered based on the situation:
VPC Peering
AWS Transit Gateway
AWS Private link