Question: why bgp is layer 7 protocol?
Answer: The layer at which a protocol operates is not defined by the nature of the data the protocol is used to communicate. With BGP, the protocol itself is used for layer3 route information exchange. however it's operation is over TCP which makes the BGP protocol (as oppose to process) an application layer protocol.