Destroy – Unity

 public static void Destroy(Object obj, float t = 0.0F);

The Unity docs have a good description of the Destroy method here. But in case you just want some quick code here it is.

To destroy a gameobject from within itself, just call 

 Destroy(gameObject);

To destroy a gameobject from within after 5 seconds

 Destroy(gameObject, 5);

To destroy a script instance from a gameobject

 Destroy(this);

To destroy a component on a gameobject, in this example a rigidbody

 Destroy(GetComponent<Rigidbody>());